You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@JSStats I was under the impression that the loop blocks are just blocks with an additional label. So it effectively has two labels, and they are both outer labels as far as the (br $foo) is concerned. Am I missing something here?
Labels have standard lexical scoping behaviour. That is, they scope over the labelled expression, and can be shadowed within their scope. The loop case is defined by its desugaring.
We could disallow shadowing, but I don't see a strong reason for that. Everything regarding names is not part of the "official" spec semantics anyway.
We could disallow shadowing, but I don't see a strong reason for that.
What is the advantage? From my perspective this has disadvantages because it is unusual and mostly creates an opportunity for confusion.
Everything regarding names is not part of the "official" spec semantics anyway.
This doesn't match our design history, and it feels like a semantic trick. In the context of tableswitch and a bunch of cases, the best way to describe the numbering of the br targets for the cases would be labels where the names are arbitrary compiler-assigned numbers.
We could disallow shadowing, but I don't see a strong reason for that.
What is the advantage? From my perspective this has disadvantages because
it is unusual and mostly creates an opportunity for confusion.
Allowing shadowing ensures locality and compositionality: without it, you
cannot syntactically insert a piece of code into another piece and expect
it to keep working. At least in general language design, that is a very
useful modularity property. Not saying it's super-important here, but I
also don't see the opposite.
Everything regarding names is not part of the "official" spec semantics
anyway.
This doesn't match our design history,
Not sure why you're saying that. The AST semantics never had names, AFAIR.
and it feels like a semantic trick. In the context of tableswitch and a
bunch of cases, the best way to describe the numbering of the br targets
for the cases would be labels where the names are arbitrary
compiler-assigned numbers.
—
Reply to this email directly or view it on GitHub #210 (comment).
Activity
[-]Document behavior of label reuse. [/-][+]Document behavior of label name reuse.[/+]binji commentedon Jan 20, 2016
Just tested this with the spec interpreter:
No error. It seems that the spec interpreter just uses the first label it finds.
mbebenita commentedon Jan 21, 2016
What about:
Is this a break or continue?
mbebenita commentedon Jan 21, 2016
If this is the behavior we want, then I guess we should spec the label search order. I feel that relying on search order is kind of error prone.
mbebenita commentedon Jan 21, 2016
@JSStats I was under the impression that the loop blocks are just blocks with an additional label. So it effectively has two labels, and they are both outer labels as far as the
(br $foo)is concerned. Am I missing something here?kripken commentedon Jan 21, 2016
I'm in favor of disallowing the ambiguous cases (1 or 2 in the first comment).
binji commentedon Jan 21, 2016
is sugar for
See https://github.com/WebAssembly/spec/blob/master/ml-proto/README.md#s-expression-syntax.
Testing this in ml-proto:
is an infinite loop.
So the search order is from "outward".
mbebenita commentedon Jan 21, 2016
@kripken option 2 is consistent with JS semantics, so I'd favor that as well.
mbebenita commentedon Jan 21, 2016
@binji ah, I see, that makes sense.
rossberg commentedon Jan 21, 2016
Labels have standard lexical scoping behaviour. That is, they scope over the labelled expression, and can be shadowed within their scope. The
loopcase is defined by its desugaring.We could disallow shadowing, but I don't see a strong reason for that. Everything regarding names is not part of the "official" spec semantics anyway.
kg commentedon Jan 21, 2016
What is the advantage? From my perspective this has disadvantages because it is unusual and mostly creates an opportunity for confusion.
This doesn't match our design history, and it feels like a semantic trick. In the context of tableswitch and a bunch of cases, the best way to describe the numbering of the
brtargets for the cases would be labels where the names are arbitrary compiler-assigned numbers.rossberg commentedon Jan 22, 2016
On 21 January 2016 at 18:14, Katelyn Gadd [email protected] wrote:
Allowing shadowing ensures locality and compositionality: without it, you
cannot syntactically insert a piece of code into another piece and expect
it to keep working. At least in general language design, that is a very
useful modularity property. Not saying it's super-important here, but I
also don't see the opposite.
Everything regarding names is not part of the "official" spec semantics
Not sure why you're saying that. The AST semantics never had names, AFAIR.
and it feels like a semantic trick. In the context of tableswitch and a