Skip to content

Conversation

monarchdodra
Copy link
Collaborator

Bug: http://d.puremagic.com/issues/show_bug.cgi?id=10517
Boards: http://forum.dlang.org/thread/odkkhkgnahhpklvumghv@forum.dlang.org

Note that the old code is considered "accepts-invalid", and is now simply illegal (no deprecation) (per Steven Schveighoffer's recommendation on Boards).

Also templatizes global readln.

Fixes a wchar issue

On topic: Is there a cleaner way to say isMutableChar!C or isMutableString!S?

Semi on topic: We have no "range terminator" signature that returns a string, eg:

string s = stream.readln("<br />");

I wanted to add it, but we can't due to ambiguity with buffered readln, which is a shame...

Just cause a file is nativelly treated as UTF16 (or something), doesn't mean you can iterate wchars.
@@ -928,7 +930,7 @@ with every line.
string s = readln(terminator);
buf.length = 0;
if (!s.length) return 0;
foreach (wchar c; s)
foreach (dchar c; s)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

foreach (C c; s)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's probably better.

@monarchdodra
Copy link
Collaborator Author

On topic: Is there a cleaner way to say isMutableChar!C or isMutableString!S?

I ended up doing if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum))

@9rnsr This made your comment "outdated": I replied to I but did not change the code.

@9rnsr
Copy link
Contributor

9rnsr commented Jul 3, 2013

LGTM.

9rnsr added a commit that referenced this pull request Jul 3, 2013
 Fix Issue 10517 - readln(Char)(Char[] buf) accepts non-mutable buffers
@9rnsr 9rnsr merged commit 3be7a03 into dlang:master Jul 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants