Checking if a string is null

Regan Heath regan at netmail.co.nz
Mon Jul 30 02:27:45 PDT 2007


Frits van Bommel wrote:
> About your analogy: If an empty envelope stands for an empty array, and 
> null arrays are different from empty arrays (as one group of posters 
> would prefer) then what would be the equivalent of a null array? No 
> envelope at all? A postcard with "This is not an envelope" written on it 
> perhaps? ;)

To steal Manfred's analogy and twist it to my own purposes.  I would say:

  - no envelope == null array
  - empty envelope == empty array
  - envelope with something in it == array with something in it.

So, when you ask your secretary give you the envelope from Bob you 
either get:

  - no envelope
  - empty envelope
  - envelope with something in it

If you then compare this to the envelope from Fred you find that:

  - If neither Fred nor Bob sent an envelope, their situation is equal

  - If Fred send an empty envelope and Bob sent no envelope, their 
situation is not equal

  - (vice versa) Fred sent no envelope, Bob sent an empty one, their 
situation is not equal

  - If Fred and Bob both send empty envelopes, their situation is equal

  - If Fred and Bob send different documents, or one does not send an 
envelope, or sends an empty envelope, their situation is not equal

  - If Fred and Bob send the same document, their situation is equal

(By situation I refer to their situation from your perspective, the 
actual reason they did or did not send an envelope is not known, that 
would require another "call" to them to find out why)

In the above the cases which are equal are:

  - Fred and Bob send no envelope
  - Fred and Bob send empty envelope
  - Fred and Bob send the same document

This is what I want opEquals to reflect, if it does we can model the 
above sitation with a single array.  As you could with a humble pointer 
in C/C++.

Regan

p.s. All this winking you do must give you tired eye muscles, or perhaps 
they are just toned! ;)



More information about the Digitalmars-d mailing list