On 24.11.2016 10:24, Kagamin wrote:
On Wednesday, 23 November 2016 at 20:24:13 UTC, Timon Gehr wrote:
Technically, there is an ambiguity (technically, ambiguity means that
there are multiple grammar derivations resulting in the same sentence).
Pragmatically, the greedy parse-the-body-if-possible-approach will work.

I see no ambiguity even if parsing is not greedy.

import std.stdio;
pragma(mangle,"_D2tt4mainFZ3fooUZv")
void foo()in{ assert(true); }{
    writeln("Hello World!");
}
void main(){
    static extern(C) void foo()in{ assert(true); }
    { foo(); }
}

Removing contracts, is this this code (printing "Hello World!"):

import std.stdio;
pragma(mangle,"_D2tt4mainFZ3fooUZv")
void foo(){
    writeln("Hello World!");
}
void main(){
    static extern(C) void foo();
    { foo(); }
}

Or this code (linker error):

import std.stdio;
pragma(mangle,"_D2tt4mainFZ3fooUZv")
void foo(){
    writeln("Hello World!");
}
void main(){
    static extern(C) void foo()
    { foo(); }
}

Reply via email to