-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Significant mismatches with AstSemantics #36
Comments
On 29 August 2015 at 03:30, Katelyn Gadd notifications@github.com wrote:
If we want to add switch uses break to suppress fallthrough at the end of a case, which is
Hm, I'm confused. Fallthrough is opt-in, there is a pseudo opcode AstSemantics specifies do-while and forever loop types; the prototype only
Right, I didn't add do-while because v8-native doesn't have it. I kind of comma isn't implemented. That will be a problem when trying to emulate
Comma is currently called Block. ;) /Andreas |
It's not 'an external syntax concern'. There need to be two labelled scopes (AST nodes) that can act as break targets; one to bail out of the loop and one to resume it at the top. That will increase the weight of every loop in an application. Loops are very common. The design in AstSemantics allows a single loop to be targeted by break and continue, with a single label. Unlabelled break/continue are a common case and those aren't possible with this model either.
From
Implicit fallthru, explicit break. As I'm reading it.
v8-native can decode the formal spec's AST nodes into whatever representation it wants. We shouldn't drop agreed-upon (or previously-agreed-upon) elements of AstSemantics to match a particular engine's implementation without a discussion.
It's definitely something you can boil down to syntax sugar, and I love factorizing the AST, but this is another big complexity hit to an obscenely common program structure. We can't casually introduce complexity to every loop scope, because not only does it make the AST more complicated, it makes it harder to binary-encode efficiently.
I don't particularly mind, but we had discussions about expression vs statement on the design repo and it sounded like people had serious objections. We shouldn't backdoor an expression/statement unification like this unless everyone's OK with it. |
On 29 August 2015 at 04:00, Katelyn Gadd notifications@github.com wrote:
Remember that ml-proto is intended as a "language spec", so you want to It is in that sense that I meant "external syntax". We are just talking As for unlabelled break, it is shorthand for break 0. Works analogously for
Ah, that.
See above, it is solely a spec device.
I agree that we need to resolve that discussion rather sooner than later. |
The issues described here are now resolved; design and spec now match, with respect to the category of issues mentioned here, though of course the current design may continue to evolve. |
[spec] Control instr should carry vals into block
Merge with upstream/wasm-3.0 This patch brings in the latest changes from the wasm-3.0. I have adopted the tag and exception handling representations from wasm-3.0.
While working on #35 I ran into many significant mismatches with AstSemantics from the design repo. I think most of them are wrong:
There's no
continue
node. This can be awkwardly emulated with More Labels(tm) but we shouldn't do that. We should implement it.switch
usesbreak
to suppress fallthrough at the end of a case, which is problematic, because it's overloading the normalbreak $label
form in a way that is ambiguous. Fallthrough appears to be automatic, instead of opt-in, also. I think it should be explicit, and the default should be non-fallthrough - that waybreak
isn't needed. That or we define a dedicated opcode likecase-break
.AstSemantics specifies
do-while
andforever
loop types; the prototype only hasloop
. This further complicates emulatingcontinue
since you need to make sure you jump to the right place.comma
isn't implemented. That will be a problem when trying to emulate particular logical/arithmetic constructs common in C++ and C#.The text was updated successfully, but these errors were encountered: