foo!(bar) ==> foo{bar}
Don
nospam at nospam.com.au
Tue Oct 7 00:32:49 PDT 2008
Walter Bright wrote:
> Nick Sabalausky wrote:
>> I would like to eventually be able to have a function like this
>> (trivial contrived example):
>>
>> repeat(int times, void delegate() d)
>> {
>> foreach(int i; 0..times)
>> d();
>> }
>>
>> And call it like this:
>>
>> repeat(3)
>> {
>> // Do stuff
>> }
>>
>> Instead of needing to use the current awkwardness of:
>>
>> repeat(3,
>> {
>> // Do stuff
>> });
>>
>> If changing "foo!(bar)" to "foo{bar}" would cause problems with that,
>> then I'd be against it. Otherwise, I'd be ok with the change, provided
>> that it didn't end up becoming visually confusing in terms of "Is that
>> a big template parameter list, or a statement block?"
>
> It may be a problem, because inside a template expansion, the template
> name with no arguments represents the current instantiation.
Is that a behaviour which needs to be retained? After all, inside the
template you have all of the template arguments, so you can write it out
long-hand. (==> It's an issue of syntax sugar, not functionality). And
I've found that you often want to have almost all of the arguments the
same, except one or two different. ( ==> It's syntax sugar which might
not be all that useful).
More information about the Digitalmars-d
mailing list