pseudo array properties

Robert Fraser fraserofthenight at gmail.com
Thu Jul 5 20:24:05 PDT 2007


> That will be a serious loss.  This 'feature' was an awesome one, and a 
> shame it never made it into the specs.
> 

On the contrary, it's in the specs for both 1.0 and 2.0:
http://www.digitalmars.com/d/arrays.html

See under "Functions as Array Properties"

Yes, I agree, it should be generalized to non-arrays. As I mentioned before, I love the natural feel of the Ruby-esque:

---
import tango.io.Stdout;

void times(int n, void delegate() action)
{
    for(int i = 0; i < n; i++)
        action();
}

void main
{
    3.times(
    {
        Stdout("Hello!").newline;
    });
}
---



More information about the Digitalmars-d mailing list