spir Wrote:

> On Wed, 01 Dec 2010 10:03:57 -0500
> vincent picaud <vincent.pic...@laposte.net> wrote:
> 
> > spir Wrote:
> > 
> > > Hello,
> > > 
> > > 1. Why isn't Unqual!(char) == char?
> > >     writeln( is( Unqual!(typeof('c')) == char ) );        // false
> > >     writeln( is( Unqual!(char) == char ) );               // false
> > >     writeln( is( char == char ) );                        // true!
> > > (dmd v2.049)
> > > 
> > 
> > Using GCD 4.3.5 ( more precisely on Linux/Debian )
> > 
> >     writeln( is( Unqual!(typeof('c')) == char ) );       
> >     writeln( is( Unqual!(char) == char ) );                
> >     writeln( is( char == char ) );                        
> > 
> > returns 
> > 
> > true
> > true
> > true
> > 
> > as expected
> 
> All right, I do not have the same results using dmd. Seems like abug, doesn't 
> it?

Perhaps... I will check at home with dmd/windows, here I only  gdc/linux

> > > 2. Why cannot one write "assert(is(Unqual(t1) == t2))"?
> > >     assert( is( char == char ) );                 // OK
> > >     assert( is( Unqual!(char) != char ) );                // compile Error
> > >     assert( is( Unqual!(typeof('c')) != char ) ); // compile Error
> > > (is() gets on my nerves ;-)
> > > 
> > 
> > not sure of that, but I think "is" is a compile time feature, hence you 
> > must write
> > static  assert( is( char == char ) );                       // OK
> > static  assert( is( Unqual!(char)  == char ) );             // OK
> > static  assert( is( Unqual!(typeof('c'))  == char ) );      // Ok
> 
> Well, on dmd:
>     static  assert( is( Unqual!(char)  == char ) );
> raises:
>     Error: static assert  (is(Unqual!(char) == char)) is false
> which is at least consistent with the result written above. But strangely, I 
> cannot reverse the predicate:
>     static  assert( is( Unqual!(char)  != char ) );
> yields:
>     found '!=' when expecting ')'
> 
> Actually, i even cannot write:
>     static  assert( is( char != dchar ) );    // same error
> 
> Is this normal? Doesn't is() allow != at all? 

I think it is the right reason, is() does not support "!=", only "=="

> > hope this can help....
> 
> Yes, helps a lot, thank you Vincent.

Thank, I m a new comer here, :)


> 
> 
> Denis
> -- -- -- -- -- -- --
> vit esse estrany ☣
> 
> spir.wikidot.com
> 

Reply via email to