DMD 1.031 and 2.015 releases

aarti_pl aarti at interia.pl
Wed Jun 18 17:06:47 PDT 2008


Walter Bright pisze:
> aarti_pl wrote:
>> Walter Bright pisze:
>>> Some new stuff to make writing templates easier.
>>>
>>> http://www.digitalmars.com/d/1.0/changelog.html
>>> http://ftp.digitalmars.com/dmd.1.031.zip
>>>
>>> http://www.digitalmars.com/d/2.0/changelog.html
>>> http://ftp.digitalmars.com/dmd.2.015.zip
>>
>> Out of curiosity... Why have you implemented template constraints 
>> syntax using additional pair of parenthesis?
> 
> Because when we tried to stuff everything into the parameter list, it 
> got kinda visually incomprehensible when the constraints got beyond the 
> trivial.

Well, it might be a bit less readable in specific (complicated) cases, 
but in general it should be more readable, because it groups same 
functionality - type matching - in the same place. It's generally good 
thing.

Let's compare:
void foo(T if isString!(T))() {}

vs.:
void foo(T)() if(isString!(T)) {}

is really second version more readable?

or:
void foo(N : N=int if N & 1)() {}
or alternatively in shorter form e.g. :
void foo(int N if N & 1)() {}

vs.:
void foo(int N)() if (N & 1) {}

[I prefer first version of syntax, which although longer, would be 
exactly same for every case, so it is much easier to learn. Currently 
there is a lot of special cases e.g. for is().]

But even if second version is visually better, I can not understand how 
strictly aesthetic argument can outweigh arguments about consistency in 
language - same syntax for a few language constructs is IMHO strong 
argument, much stronger than visual appearance. It is much easier to 
learn such a language, because you can just apply same pattern for few 
different, but similar cases. And also arguments from my first posts 
(e.g. natural order of symbols declaration) are still valid...

But anyway thanks - this is rationale although I don't agree fully :-)

BR
Marcin Kuszczak


More information about the Digitalmars-d-announce mailing list