Stripping away const/invariant in D 2.0

Bruno Medeiros brunodomedeiros+spam at com.gmail
Tue Aug 28 14:30:45 PDT 2007


Christian Kamm wrote:
>>> I've been trying to work this out for a few hours now, and I'm drawing a
>>> blank.  In D 2.0, there doesn't appear to be any way of deriving the
>>> type of T given either (const T) or (invariant T).
>> Use "typeof(T)". For example if T is invariant char , then typeof(T) ==
>> char. typeof() kinda works like a declaration, so it removes the top
>> level const/invariant.
> 
> This works for plan data like char (since const(char) really is the same
> type as char, if I understand it right - there's no 'tail' that could be
> const), but not for reference types:
> 

I know that, that's what I meant when I said it removes "the top level" 
const/invariant. Maybe not the best of terminology, it was just 
something that I had used before. And I haven't read about this new 
head/tail stuff yet.

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list