3 ms·
> The specification lacks examples, and seems to be very underspecified. See "Putting It All Together" http://asmjs.org/spec/latest/ http://asmjs.org/spec/late
by ndesaulniers 12y ago
> The specification lacks examples, and seems to be very underspecified.
See "Putting It All Together" http://asmjs.org/spec/latest/ http://asmjs.org/spec/latest/
From that example, the list of return types from operators (section 8), and the graph of value types (section 2.1), it is simple to figure out, if not a little foreign at first.
- jvilk 12y agoThe example doesn't use the FFI, though. And I understand the graph of value types and the restrictions that ASM.js imposes on ASM.js code, but there's no clear linkage between that and the FFI. Some other FFIs require you to encode type information in some manner to uphold the guarantees of the language. It's not clear from scanning the specification if that is the case here, as the FFI is only briefly mentioned in passing. Finally, ASM.js doesn't validate the return expression of external functions (it does for ASM.js code [0]). How does it deal with foreign functions that return values? What type does the return value take? Or does there need to be an annotation at the call site? [0] http://asmjs.org/spec/latest/#return-type-annotations http://asmjs.org/spec/latest/#return-type-annotations