My body is ugly [Re: Contextualizing keywords]

Don nospam at nospam.com
Mon Aug 3 04:20:45 PDT 2009


Michiel Helvensteijn wrote:
> Pete wrote:
> 
>> I think this is much more elegant:
>>
>> # int foo(int a) {
>> #    in {
>> #       assert(a>2);
>> #    }
>> #
>> #    return a-1;
>> # }
> 
> I have to disagree. That suggests that 'in' is a scope within the body,
> which would have access to its local variables. Of course, it shouldn't.

If you make 'in' clauses 'pure' (which they are, conceptually), it works 
fine.

I agree with Pete, I think that's a greatly superior syntax to what we 
have now.





More information about the Digitalmars-d mailing list