property syntax strawman

Nick Sabalausky a at a.a
Sun Aug 2 13:21:07 PDT 2009


"Oliver Hoog" <kingboscop at gmail.com> wrote in message 
news:h54ccl$1v3l$1 at digitalmars.com...
>
> But you would have to write more than necessary. Simpler is:
> ---
> bool foo {
> in(bar) { ... }
> out { return ... }
> }
> ---
> in is translated to: void in(bool bar) {...}
> out is translated to: bool out() {...}
>
> To get a delegate to in:
> auto f = &foo.in;
>
> foo = 5; is equivalent to foo.in(5);
>
> This way you don't need any new keywords or ugly (double) underscores.
> And it's unambiguous and pretty clear.

Yes! Or wait, even better yet:

static foo {
static(static) { ... }
static static { static ... }
}

In fact, let's *really* minimize the number of keywords in D:

// From:
int main(char[][] args)
{
    if(args.length == 1)
        return 1;

    return 0;
}

// To:
static static(static[][] static)
{
    static(static.static== 1)
        static 1;

    static 0;
}

Perfect! Now we'll never have to worry about having too many keywords!





More information about the Digitalmars-d mailing list