question...

Aarti_pl aarti at interia.pl
Thu Jan 10 01:54:48 PST 2008


Bill Baxter pisze:
> Aziz K. wrote:
>> Marcin Kuszczak wrote:
>>> Thanks but explanation. But I think that somethink is wrong here anyway.
>>> Please see first example. 'A' is also not expression, but it compiles
>>> properly. Maybe it would not be a big problem to extend typeof in such a
>>> way that it can accept types also.
>>>
>>
>> This is the example:
>> class A {}
>> static assert(is( typeof(new A) == typeof(A)) ); // 1
>> [...]
>> You suggested to extend typeof to allow Types as well. I don't think 
>> that's a good idea and I think it's not going to happen (ie. Walter 
>> won't implement it.) The reason is that typeof has one perfect 
>> purpose, that is to get the type of an expression. I don't see any 
>> sense in passing a Type to typeof in order to get what you had in the 
>> beginning anyway. Maybe there could be a legitimate use-case for this, 
>> but I'd like to see convincing examples where this would be meaningful 
>> and useful.
> 
> Yes, if anything typeof(A) should logically be "Type".  I.e. the type of 
> types. (which is what you get in Python and probably other languages 
> with first-class types)
> 
> --bb
> 

I don't understand your argument. My proposition doesn't change this 
behavior at all. typeof(<type>) is just special a special case for 
typeof(<many types>).

BR
Marcin Kuszczak
(aarti_pl)


More information about the Digitalmars-d-learn mailing list