null == "" is true?

Bienlein ffm2002 at web.de
Tue Jul 19 15:30:30 UTC 2022


>> why?
>
> Because an empty string is, by default, represented by an empty 
> slice of the null pointer.

I don't program in D. I just read from time to time posts in the 
D forum because of the good quality of what people write. So, I'm 
not proficient in D, but in general internals should not boil up 
to the surface.

> In my experience null and empty in DTOs usually play the same 
> logical role.
Oh, oh ...

>IIRC someone wrote a master thesis about the different roles for 
>null values in databases >and came up with many different null 
>situations (was it five?).
Oh, oh, oh ...

I once worked on a system where some little robot running on a 
track picked up material in carriers from some machine and then 
brought it to the next machine. If the destination of a carrier 
was set to null, it implied that the destination was currently 
undefined. Then the robot brought the carrier to some rack where 
it was put aside for a while till the planning system had created 
a new production plan. The number of null pointer exceptions we 
had to fix because auf this was countless. Never make null imply 
some meaning ...


More information about the Digitalmars-d-learn mailing list