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

superdan super at dan.org
Mon Oct 6 14:24:01 PDT 2008


Nick Sabalausky Wrote:

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

nagonna be a problem. it's been discussed. id { stuff }is instantiation. id(optional stuff) { stuff } is that thing yer talkin' about.



More information about the Digitalmars-d mailing list