Open
Description
Could TextIOWrapper
be made to be an enumerable of string? I am able to do this with a cast, which generates a call to get_enumerator
that happens to call iter()
on the object and work:
use result = builtins.``open`` ("test.txt", OpenTextMode.Read)
for (line: string) in !!result do
let line = line.Trim()
builtins.print $"'{line}'"
I can also use readline directly for a typesafe verison, but as a side note, I also noticed that it requires a parameter, where as the parameter should be optional:
use result = builtins.``open`` ("test.txt", OpenTextMode.Read)
let mutable line = result.readline (-1)
line <- line.Trim()
while line <> "" do
line <- line.Trim()
builtins.print $"'{line}'"
line <- result.readline (-1)
Metadata
Metadata
Assignees
Labels
No labels