News for hackers. Stuff that matters.
Re:Call for support for Lisp in WebAssembly development by klodolph on Friday March 11, 2016 @08:03PM (#11270739)
From digging, it looks like the issue here (or one of the issues) is that the Web Assembly encoding for some Lisp uses cases (multiple value return) is not very compact. Making the proposed change would presumably reduce the size of Lisp code once compiled to Web Assembly, it would not really affect the behavior of the program once compiled to native code.

I can relate to the Web Assembly team's reluctance to add features which are only really wanted by a small subset of users, especially when they only affect the binary size. These features, if implemented, may suffer from poor test coverage. My own preference is that compact binaries are nice but if you're going to use a high-level language, an increase in binary size is just expected (say, an order of magnitude) unless the encoding/VM and language were designed in concert (Java + JVM, or C# + CIL are two examples). Heck, C++ binaries can be enormous.

Then again, I didn't dig deep enough to really understand the nuances of the argument. Perhaps someone could elaborate.

Re:Call for support for Lisp in WebAssembly development by vmorgulis on Friday March 11, 2016 @08:23PM (#11270808)
The target prevails over the language. The implicit intent is to convert LLVM bitcode.

"Please keep in mind that Wasm is not a user-facing language, it is a compilation target. To justify the extra complexity of this feature for its own sake, you would need to come up with convincing evidence that compilers would significantly benefit from it. I doubt that."

https://github.com/WebAssembly/spec/pull/215#issuecomment-17...

Re:Call for support for Lisp in WebAssembly development by dietrichepp on Saturday March 12, 2016 @12:51AM (#11271576)
I like the wording "compilers would significantly benefit from it" because if only SBCL benefits, then that's only "compiler" not "compilers".
Re:Call for support for Lisp in WebAssembly development by PuercoPop on Saturday March 12, 2016 @02:12AM (#11271689)
Why are you talking about SBCL here? This is not for the benefit of SBCL, which does not target Web-Assembly, but about implementing multiple return values easily. Yes not many languages have multiple return values today, but Web Assembly should not only focus on implement only the languages that are popular today but the languages of the future.
Re:Call for support for Lisp in WebAssembly development by nemoniac on Saturday March 12, 2016 @07:55AM (#11272660)
While I agree wholeheartedly with this point, I have to smile at it being made about one of the oldest programming languages still in use.

In some ways Lisp has always been and continues to be the language of the future.

Re:Call for support for Lisp in WebAssembly development by dietrichepp on Saturday March 12, 2016 @03:44AM (#11271956)
From what I understand, it really is just Lisp, not any language with multiple return values. The issue here is Lisp semantics for multiple return values being slightly cumbersome (but by no means difficult).
Re:Call for support for Lisp in WebAssembly development by junke on Saturday March 12, 2016 @04:44AM (#11272155)
The discussion on github also mentions Lua (https://github.com/WebAssembly/spec/pull/215#issuecomment-17...), though it is true that this is coming from a Common Lisp developer.

From my point of view the feature is useful (efficient implementation without useless memory allocation) and the rebuttal looks slightly uninformed.

There are discussions about coroutines (https://github.com/WebAssembly/design/blob/master/FutureFeat...) and more generally about low-level capabilities (https://extensiblewebmanifesto.org/). Among those, we can see in the design document (https://github.com/WebAssembly/design/blob/4dec2849ad6d79fae...) a "Multiple Return Values" section with a "TODO" placeholder text: it seems that WebAssembly people want to implement MRV.

Re:Call for support for Lisp in WebAssembly development by thinkpad20 on Saturday March 12, 2016 @12:21PM (#11273611)
Go has multiple return values; could this also benefit go? I'd bet that that would garner more calls for MRV support in wasm if so.
Re:Call for support for Lisp in WebAssembly development by _3u10 on Saturday March 12, 2016 @03:11AM (#11271812)
This is the (infinite) loop that keeps us with C.

Lets not do X because it would benefit Y which no one uses. No one uses Y because it's slow because no CPU supports X.

Very few people think the future really exists.

Re:Call for support for Lisp in WebAssembly development by CyberDildonics on Saturday March 12, 2016 @12:38PM (#11273672)
You think languages are slow because they aren't 'supported' by the CPU?

A dynamically typed language isn't going to start running at the speed of C with some extra CPU engineering.

Re:Call for support for Lisp in WebAssembly development by ihuman on Saturday March 12, 2016 @11:28AM (#11273382)
Aren't there other Lisp compilers, besides SBCL? What about Lisps besides Common Lisp, like Scheme?
Re:Call for support for Lisp in WebAssembly development by junke on Saturday March 12, 2016 @05:25AM (#11272250)
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

Re:Call for support for Lisp in WebAssembly development by qwertyuiop924 on Saturday March 12, 2016 @12:28PM (#11273638)
In lisp, it's a first-class feature. I think that this was a godawful mistake, but many disagree, and here we are.
Re:Call for support for Lisp in WebAssembly development by junke on Saturday March 12, 2016 @01:53PM (#11273957)
The 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

Re:Call for support for Lisp in WebAssembly development by qwertyuiop924 on Tuesday March 15, 2016 @07:54AM (#11288921)
You 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.

Re:Call for support for Lisp in WebAssembly development by kuschku on Friday March 11, 2016 @08:12PM (#11270773)
Then again, if the WebAssembly team makes that argument, we might as well just use JavaScript + ASM.js
Re:Call for support for Lisp in WebAssembly development by rubber_duck on Friday March 11, 2016 @09:14PM (#11270979)
Not really, aside from smaller binary size parsing a binary bytecode vs parsinga a JS pseudo bytecode is a huge difference in load time + they get to optimize it for efficient translation vs trying to hack JS constructs to get desired semantics and then trying to recognize those in the JIT

Asm.js is a hack made with ducktape and chewing gum, wasm is a solution designed/engineered to solve the general problem - not just smaller asm.js

Re:Call for support for Lisp in WebAssembly development by dietrichepp on Saturday March 12, 2016 @12:58AM (#11271584)
ASM.js builds can be quite large, even 10s of MB is not uncommon. Reducing the binary size isn't just "nice to have", it changes the viability of the platform.
Re:Call for support for Lisp in WebAssembly development by kuschku on Saturday March 12, 2016 @05:40AM (#11272284)
But wasn’t the argument of the wasm team against the LISP features that binary size isn’t relevant and just a "nice to have" feature?
Re:Call for support for Lisp in WebAssembly development by dietrichepp on Monday March 14, 2016 @07:24PM (#11286346)
I don't think anyone is arguing that binary size isn't relevant. It just has to be weighed against the other parameters we want to optimize, like implementation complexity.
Re:Call for support for Lisp in WebAssembly development by deadowl on Friday March 11, 2016 @09:07PM (#11270951)
Any way to reconcile power-of-two memory structure and boundary checks? I can't imagine all code should be constrained to power-of-two memory, but if you throw in multi-threading somehow, I think it would start making more sense to have the best of both worlds.