null == "" is true?
Antonio
antonio at abrevia.net
Wed Jul 20 08:59:16 UTC 2022
On Tuesday, 19 July 2022 at 16:55:39 UTC, Kagamin wrote:
>
> As I understand, in your scenario there's no difference between
> null string and empty string, they both work like empty string,
> and D treats them as empty string. That's what I mean when I
> said that distinction between null and empty is meaningless.
Sorry Kagamin... I dindn't read this comment and I added a very
large answer to the next one that has no sense :-p. I miss being
able to delete answers from the forum :-)
**Yes... I decided to treat the same way internally** for strings.
Previously
* `DtoVal!(Null, string)( null)` was equivalent to
`DtoVal!(Null,string)( Null() )`
* `DtoVal!(Null, Person)( null)` was equivalent to
`DtoVal!(Null,string)( Null() )`
Currently
* `DtoVal!(Null, string)( null )` is equivalent to
`DtoVal!(Null,string)( "" )`;
* For other types this will raise a runtime exception:
`DtoVal!(Null, Person)( null )`.
* The correct way of is `DtoVal!(Null, Person)( Null() )`
Basically, **`null` is completely useless and out of my code**
with the exception of strings.
Best regards
Antonio
More information about the Digitalmars-d-learn
mailing list