On Sunday, 14 September 2014 at 09:07:26 UTC, Kagamin wrote:
On Sunday, 14 September 2014 at 00:34:56 UTC, WhatMeWorry wrote:
So is one form (Empty strings versus null strings) considered
better than the other? Or does it depend on the context?
For all practical purposes they should be equivalent in D code.
I suppose the distinction exists because somebody claimed he
can make sense of it. Some API may rely on distinction between
null and empty string, like XML DOM, though I don't think such
interface is very useful.
Also for some reason boolean value of a string is derived from
ptr instead of length... meh.
Which makes sense given the distinction exists, IMO. Compare for
example with Ruby, where empty strings and `0` integers also
evaluate to true, but only `nil` and `false` evaluated to false.