property syntax strawman
Jarrett Billingsley
jarrett.billingsley at gmail.com
Sun Aug 2 13:32:34 PDT 2009
On Sun, Aug 2, 2009 at 4:21 PM, Nick Sabalausky<a at a.a> wrote:
> "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!
'static' is a woefully underused keyword. It really does need more uses.
More information about the Digitalmars-d
mailing list