How about a special null template parameter?
Engine Machine via Digitalmars-d
digitalmars-d at puremagic.com
Mon Aug 22 11:24:21 PDT 2016
On Monday, 22 August 2016 at 15:58:14 UTC, Meta wrote:
> On Sunday, 21 August 2016 at 21:21:22 UTC, Engine Machine wrote:
>> Well, I see that a template with 0 parameters can act as a
>> "type", if you will.
>>
>> Just like functions
>>
>> void foo(T)(T x)
>>
>> acts like a normal function foo(3) even though it is a
>> templated function.
>>
>> In fact, I see very little difference between a template with
>> 0 parameters and a type.
>>
>> Type!() = Type
>
> I think this is a very bad idea theory-wise, if not in practice
> as well. A template is a type constructor, not a type. They are
> two very different things. You can get the size of a type, its
> members, etc. while you cannot for a template.
Yeah, maybe... but I think this is a user issue and not a
language issue. The programmer should attempt to know what he is
doing. I'd prefer to use an extended ascii syntax so we can have
proper categorization of things.
e.g.,
æType - a type
½Template - a template
Or whatever.
That way it is very easy to know what is what ;) Symbols may
vary...
More information about the Digitalmars-d
mailing list