foo!(bar) ==> foo{bar}

Nick Sabalausky a at a.a
Mon Oct 6 13:37:00 PDT 2008


"Walter Bright" <newshound1 at digitalmars.com> wrote in message 
news:gcdqa4$qas$1 at digitalmars.com...
> The foo.(bar) syntax seems to be sinking. The foo{bar} seems to be the 
> most practical alternative. So, how about putting it in the next D2 
> release on a trial basis, so people can try it out and see how it looks?

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?" 





More information about the Digitalmars-d mailing list