Re:Moonshine – A lightweight Lua VM for the browser
by MattJ100 on Tuesday April 01, 2014 @10:27AM
(#7508398)
For the people that wrote Moonshine, it was the ability to use the same language across all platforms[1]. They already have a lot of Lua code on other platforms that was unable to run on the web (without using Flash, which also has a Lua VM available for it).
Lua is very portable, I wouldn't choose Javascript to replace it for multi-platform game development. However Javascript has a monopoly on the web. I don't see why this ought to be.
[1]: Source: https://skillsmatter.com/skillscasts/3820-developing-a-lua-v...
Re:Moonshine – A lightweight Lua VM for the browser
by stcredzero on Tuesday April 01, 2014 @10:25AM
(#7508378)
WHY? I mean, Lua is a dynamic language with first class functions just like Javascript is, no big difference here.
You can use objects as keys in Lua. This makes a lot of code in Lua a pain to port to JavaScript. I have Lua code I would like to port to JavaScript that this applies to.
Re:Moonshine – A lightweight Lua VM for the browser
by nnq on Tuesday April 01, 2014 @10:29AM
(#7508413)
Got some sample code or a link to it? I really like figuring out ways to express existing code in a different style/pattern/language :)
Re:Moonshine – A lightweight Lua VM for the browser
by Excavator on Tuesday April 01, 2014 @02:00PM
(#7510315)
Map¹ might've been an option, excepting no support in Safari and IE < 11. Although I dunno about the performance hit, if any.
¹ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
I understand clojurescript, parenscript and haskell to js compilers, because these languages are really different from javascript, so they offer you a very different way of working and different tradeoffs (Clojure, CL, Haskell offer you the ability to choose a programming style that is just not possible in Javascript). Maybe even Opal or Amber - rubyan/smalltalkian oop semantics really are very different from Javascript's and you end up using very different design patterns. And I understand the wish to have static typing for large projects/teams, ergo TypeScript or Dart.
But I really don't understant why would anyone go through such pain (by pain I mean not writing the transcompiler/vm, this is the fun part, I know, but debugging it, maintaining it and debugging the code you use it on), to use a language so similar to Javascript, like Lua or Python, instead of using just plain Javascript and making some minor effort to 'use strict', avoid some dark corners and get used to living with a little less syntactic sugar?