foo!(bar) ==> foo{bar}
Walter Bright
newshound1 at digitalmars.com
Mon Oct 6 20:39:02 PDT 2008
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.
More information about the Digitalmars-d
mailing list