After reading most of the tour.dlang.org website, I was completely surprised & confused encountering 'KeepTerminator', a 'Flag' used by the File.byLine function. With no examples denoting how to use it.

Most confusing was the way the documentation (website & in-editor) used;
1. Yes.keepTerminator
2. KeepTerminator.yes
3. Flag!"keepTerminator".yes
& Don't get me started on the autocomplete trying to get me to use KeepTerminator.Flag.yes (VSCode & code-d)

Now some documentation stated these flags are used to improve readability, when compared to simple booleans, but all these different notations seem super confusing, especially since I dont understand why Flag requires a !"Name" part. And I haven't read anything about it in the language tour, nor have I found any discussion on the topic elsewhere. I did find, for some reason, a second 'KeepTerminator' documentation page . . . which is from std.string, which understandably did not help clear things up.

Even further confused by the in-editor documentation, is this function a template?:
"
byLine(Terminator = char, Char = char) (KeepTerminator keepTerminator = No,keepTerminator, Terminator terminator = '\\n')
"

I'm sorry, I may be asking for too much, but I've got so many questions and found few answers.
1. Did I miss some tutorial?
2. Why does flag require a name (!"Name")?
3. Is byLine a template, if so, how would one use it differently?

Reply via email to