[Issue 14998] Cannot put a char into a char[]

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Dec 1 10:47:31 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14998

--- Comment #7 from Steven Schveighoffer <schveiguy at yahoo.com> ---
Except that's not exactly the reason. The reason is because no implementation
exists to support it. Quite literally, the compiler tried to find a suitable
mechanism, and couldn't.

Changing the error message to be more specific to this situation may read
confusingly for another case where that *isn't* the problem.

I think it's possible we could make a special message for these situations, the
code is already pretty dead set against allowing this (and has special cases to
handle it). I just don't know what the correct answer is.

I was just reading this on the docs:
http://dlang.org/phobos/std_range_primitives.html#.put

"r.putChar(e);     R accepts some form of string or character. put will
transcode the character e accordingly."

In the implementation of putChar, it specifically forbids r to be a dynamic
array. So we may want to add a note that R cannot be a dynamic array of char in
this position (I'm unsure why, since it is possible). I will note that before
the "putChar" function was added, it still didn't compile.

--


More information about the Digitalmars-d-bugs mailing list