shouting versus dotting
Janderson
ask at me.com
Sat Oct 11 17:28:51 PDT 2008
Andrei Alexandrescu wrote:
> Don wrote:
>> Janderson wrote:
>>>
>>> Personally I don't think that we should just change the symbol ! to .
>>> because it will break a load of libraries for purely an ascetic
>>> change. Its difficult to argue that . is better then ! as it depends
>>> on the person reading the code. However if a template change allows
>>> for more functionality then it might be worth considering.
>>>
>>> Anyway extending a previous suggestion. What about using ;?
>>>
>>> Foo(int T, alias X; T val, X val2);
>>>
>>>
>>> One clash I can think of is that it might get mixup with a for loop,
>>> however I imagine that's easily detectable. Also its slightly harder
>>> to make a distinction between the template args and the value however
>>> on the positive side its less typing.
>>>
>>> -Joel
>>
>> This is the first suggestion which really interests me. It's really
>> short, and there is some precedent for the use of ; as a separator
>> from for/foreach.
>>
>> But what do you do for non-function templates, which is really the
>> problem case? I think you end up with a bunch of ;);), which maybe
>> looks a bit odd.
>>
>> auto v = new Vector!(Stack!(Tuple!(Positive!(real),
>> Matrix!(real))))(3, 3));
>>
>> becomes:
>> auto v = new Vector(Stack(Tuple(Positive(real), Matrix(real;););); 3, 3);
That's a good point. I think the ; should be optional for cases when
there's no parameters (would that still work?).
auto v = new Vector(Stack(Tuple(Positive(real), Matrix(real))); 3, 3);
Also I think that any nested template syntax will be hard to read,
that's why I prefer to use typedef/alias.
>
> It does look winky though :o).
>
> Andrei
When I write code I want it to smile back at me :)
-joel
More information about the Digitalmars-d
mailing list