4 ms·
This is not only about code size, but about efficiency and, more fundamentally, about what multiple values are. Are MRV just syntactic sugar around lists, a sec
by junke 11y ago
This is not only about code size, but about efficiency and, more fundamentally, about what multiple values are. Are MRV just syntactic sugar around lists, a second-class mechanism ("tuples don't nest") for when you have zero-or-one return value, or a first-class feature which can benefit from the support of the runtime compiler?
https://github.com/WebAssembly/spec/pull/215 https://github.com/WebAssembly/spec/pull/215
- qwertyuiop924 11y agoIn lisp, it's a first-class feature. I think that this was a godawful mistake, but many disagree, and here we are.
- junke 11y agoThe last time you discussed about this[0], you attributed to Common Lisp some problems that were present with Scheme's multiple values. And here, as explained in this thread, Wasm is not a user-facing language but the target of compiler, which means that the usual complaints about the somewhat verbose binding constructs of CL's values (which I find acceptable as a user) are not a problem either, since the code ought to be generated from other languages (which might even not define multiple values themselves, but for which a compiler could generate code that use MVR). It seems that the only acceptable way to produce multiple values for you is to return a composite value. I think that having a dedicated type to represent multiple values is a useful tool to give to the programmer. [0] https://news.ycombinator.com/item?id=11240383 https://news.ycombinator.com/item?id=11240383
- qwertyuiop924 11y agoYou can think that. I disagree. That's fine. Good on you. And yes, I did mis-attribute some problems with Scheme's implementation of MVR to common lisp. However, I admitted to the mistake in that thread, and eventually got the idea. So please, don't confuse the issue. Here, I'm not talking just about lisp. I just don't like MVR in general. And yes, I think that a composite value is the only good way to produce multiple values. But I don't have an objection to WASM adding MVR, because it's compiler facing, as you pointed out. I object to higher lever languages adding it.