Custom control flow statements
Mikola Lysenko
mclysenk at mtu.edu
Tue Feb 13 13:25:28 PST 2007
Michiel wrote:
>> void a()
>> {
>> writefln("starting");
>>
>> {
>> scope(exit) writefln("blah");
>> }
>> }
>>
>
> I think the semicolon would be in the way. I don't think this syntactic sugar is
> in conflict with any existing syntax. You can never create a function with the
> name 'scope' or 'for' or 'if', so there's no problem there either.
>
> Or am I missing something?
No, you're absolutely right. My mistake about the semicolon.
I guess my main concern is what happens when semicolon typos occur. If
something like this is valid:
if(true)
writefln("foo");
Would the same logic apply in situations like:
writefln("foo")
writefln("bar");
More information about the Digitalmars-d
mailing list