[Mono-list] Object additional implicit operator.

Rolf Bjarne Kvinge rolflists at ya.com
Fri Aug 15 17:27:33 EDT 2008


> >
> >> Sorry, I'll drop this point.
> >>
> >> It would have been really really simple when the language was
> conceived
> >> to consider that a simple test for object existance should not
> require
> >> the
> >> specification of a null constant;
> >
> > It would make things very weird, things like !((object) true)) would
> > return
> > true.
> >
> >
> 
> How does that expression even mean anything?
> Wouldn't you get like expected operator before true ?
> 
> 		{
> 
> 			bool whatever = true;
> 16:			if( !((whatever)true)))
> 	 			Console.WriteLine( "true" );
> else
> 	Console.WriteLine( false" );
> 		}
> 

'(object)' is a cast, a full sample to make it easier to understand:

{
  object o = false;
  if (!o)
    Console.WriteLine ("true");
  else
    Console.WriteLine ("false");
}

would print false (or is it true? I can't really make my head around this)

Rolf



More information about the Mono-list mailing list