How about a special null template parameter?

Engine Machine via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 20 12:16:25 PDT 2016


On Saturday, 20 August 2016 at 13:45:59 UTC, poliklosio wrote:
> On Friday, 19 August 2016 at 18:25:06 UTC, Engine Machine wrote:
>> So we can create types relationships easier:
>>
>> class Type(T) : Type!null
>> {
>>    int x;
>>    static if (T is Dog)
>>        int y;
>> }
>>
>> Type == Type!null (!null implicit, only if defined in the 
>> above way. Essentially an alias is created for us 
>> automatically)
>
> This syntax would be very confusing to a non-expert. It is a 
> special case of an existing features (inheritance and 
> templates), which makes it hard to learn about, as all 
> resources are going to discuss those other features first, and 
> only the most detailed readings are going to contain this 
> detail. Moreover, it does not introduce a keyword or any other 
> name, so it is almost impossible to Google. Try googling 
> something like "template<class T> class a class b: public 
> a<b>", and see which result contains "curiously recurring 
> template pattern". It is hard to find, isn't it?
>
> Moreover, as indicated by another poster, null is already a 
> valid template parameter, making it even more confusing. Also 
> it is unclear when the interpretation would be as you propose.
>
> You need to appreciate the difference between write-only code 
> and code that can be easily read, reviewed and understood.
>
> Dlang has already went too far in inventing pieces of 
> non-obvious syntax for template features. Lets not make the 
> situation worse.
>
> Distill what you want to do, see what use cases are covered by 
> other features and libraries, name your thing accordingly and 
> then propose.

Do you not realize that if every human endeavor was to bow down 
to the lowest common denominator there would be no point?

If Walter had the notion "I have to make D so the beginner can 
understand it easily" Then D would be javascript or php?

If you want to be an idiot and use an idiot language, then there 
are many out there. Go program in BASIC.

So your arguments appealing to ignorance(not the logical fallacy, 
of course) is non-sense.  Life is complex, stop trying to reduce 
it to something you already can understand. I think, technically, 
this is called laziness.








More information about the Digitalmars-d mailing list