On Friday, 25 January 2013 at 14:43:01 UTC, Ali Çehreli wrote:
On 01/25/2013 06:22 AM, Don wrote:
No, it's from 2002 (well, it was !==, renamed to !is in 2005). Bearophile only joined us about the time D2 began, in late 2007.

Ok. How about !in then? Did he lobby for that one? :)

   //hmmm doesn't read right
   if (ptr in not null)

   //huh? is it an array or an AA now?
   if (ptr not in null)

   //ummm feels like an AA. I'm sure if we used
   //it it would become second nature.
   if (ptr !in null)

   //silently converts to...?
   if (!(ptr in null))

   //make sense to me. Course in java === was
   //used for ptr checking rather than contents.
   if (ptr === null) //is null
   if (ptr !== null) //not null, both stand out

   //mentally I reverse !is to equal 'is not'.
   //I know I'm comparing pointers.
   if (ptr !is null)


  Code example:
  string[string] aa;
  string* ptr;

  if ("dog"   in aa)    //returns ptr
  if ("dog"  !in aa)    //i think it's bool of 'found'
  ptr = "dog" in aa;
  if (ptr     in null)  //errors, not an aa, searching null?
  if (ptr    !in null)  //not searching null?

  change to...
  string[string[string]] aa;
  string[string]* ptr; //(string[string])* ptr; ??

  if ("dog"   in aa)   //returns ptr (of an aa), search
  if ("dog"  !in aa)   //still makes sense... a search.
  ptr = "dog" in aa;
  if (ptr     in null) //becomes ((*ptr) in aa), search?

  //(!((*ptr) in null))//AA search or pointer compare?
  if (ptr    !in null)

null can still be replaced by any variable/pointer, if that pointer is an aa as well... Ugg I don't wanna find out all the combinations to figure it out...

After looking at all these 'in' should be reserved for array searching, not pointer checking. It makes more sense to me that way.

Reply via email to