On 2013-10-18 17:32:58 +0000, Jonathan M Davis said:

On Friday, October 18, 2013 09:55:46 Andrei Alexandrescu wrote:
On 10/18/13 9:26 AM, Max Samukha wrote:
*That's* bad API design. readln should be symmetrical to writeln, not
write. And about preserving the exact representation of new lines,
readln/writeln shouldn't preserve that, pure and simple.

Fair point. I just gave one possible alternative out of many. Thing is,
relying on client code to distinguish subtleties between empty and null
strings is fraught with dangers.

Yeah, but the primary reason that it's bad design is the fact that D tries to
conflate null and empty instead of keeping them distinct (which is essentially
the complaint that was made). Whether that's ultimately good or bad is up for
debate, but the side effect is that relying on the difference between null and
empty ends up being very bug-prone, whereas in other languages which don't
conflate the two, it isn't problematic in the same way, and it's much more
reasonable to have the API treat them differently.

- Jonathan M Davis

Null and the Empty Set are different entities. A set containing exactly nothing, vs undefined. However, null is not handled properly in D or any other systems language since it's simply a pointer with value = 0. if (null == 0) is a true statement in C, C++, and D, but is not in fact true. Null is neither equal to zero, nor not equal to zero.

Reply via email to