[dmd-beta] const attribute etc

Andrei Alexandrescu andrei at erdani.com
Sun Jun 2 19:51:26 PDT 2013


Type constructor is a language construct that literally constructs a 
type (not a value), usually from one or more types. E.g. T[K] is a type 
constructor - given types T and K, constructs the type hash map etc.

So "new const(C)" is not a type constructor, it's at best an expression 
that constructs a value. "const(C)" is a type constructor that takes a 
type C and constructs a new type.

Type modifier is loosely-defined as a type constructor that takes one 
type and alters its properties just a bit.


Andrei

On 6/2/13 7:35 PM, Andrej Mitrovic wrote:
> On 6/3/13, Andrei Alexandrescu<andrei at erdani.com>  wrote:
>> I think I have an understanding how that dual nature works for C++, but
>> not in D. Could you please give more detail. Then we can merge that with
>> the documentation, so you wouldn't have wasted time.
>
> Oh yes, and then you can close this:
> http://d.puremagic.com/issues/show_bug.cgi?id=9970
>
> But from my limited understanding:
>
> new const(C) ->  type constructor
> cast(const(C))(new C) ->  type modifier
> void foo(const(C)) ->  type modifier
>
> Correct? No?
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta


More information about the dmd-beta mailing list