I was on a team that used Lua in production on tens of thousands of machines running 24/7. The Lua interpreter was the weak link in the system, requiring at least daily restarts. Squashed so many bugs over the years, and still found more and more all the time. What I'm saying is, the Lua interpreter itself is flawed and I can't imagine using it as a runtime if I had the chance to avoid it. That said, the language was…
Ever used luaJIT?
MoonScript, a programmer friendly language that compiles to Lua
131–140 of 171 posts
Re: MoonScript, a programmer friendly language that compiles to Lua
#132On a related topic, Haxe now compiles to Lua as well : https://haxe.org/blog/hello-lua/ (disclosure : I'm the author of the lua target) Back to moonscript/Lua, I've been super impressed with the YAGNI principals of the language. I was originally drawn to LuaJIT and its raw speed, but there's a lot of great things to say about the language and its community. My goal is to write more Lua for smaller scripting purposes,…
Re: MoonScript, a programmer friendly language that compiles to Lua
#133This is one of @leafo's excellent projects. He has developed a web framework for MoonScript called Lapis. One of the cool things about Lapis is that it runs on top of OpenResty, which is a high performance web server for Lua applications. Lapis is production-ready: it runs his amazing game marketplace, itch.io.
I was looking into using it to make a site for hosting Love2D games which would optionally run right in the browser, because lua rocks, but I got distracted with other things.
Re: MoonScript, a programmer friendly language that compiles to Lua
#134Lapis + MoonScript + OpenResty looks like a lot of fun, so I was just starting to get a local environment running for it and immediately ran into the Lua 5.1 and 5.2+ divergence. For someone who has just been a casual observer of the Lua ecosystem over the years, can someone talk about the community's feelings towards that divergence? The OpenResty docs basically state it's not worth the effort to support anything bu…
The reason is that the _ENV feature added in 5.2 would significantly slow down LuaJIT if it were supported. It's possible that Luac and LuaJIT will re-converge when Lua 6.0 is released, but arguments about this between Mike Pall amd Roberto Ierusalimschy have been unproductive so far. Until then, LuaJIT compiles Lua 5.1 with support for a few 5.2 and 5.3 features, particularly goto.
Re: MoonScript, a programmer friendly language that compiles to Lua
#135Earlier quoted context omitted.
I don't really get your reasoning. For an iterative method, you have an initial value a[0], then take your NUM_STEPS steps, so the final result is a[NUM_STEPS]. If it's one-based, the final result is a[NUM_STEPS+1]. This type of thing trips up my Matlab (one-based) students all the time. In zero-based linear algebra, the indices i and j start at 0, so the top left entry of a matrix is a[0, 0], the pivot element is a[…
yeah i think maybe numericals aren't the best example since the initial value is always labeled x_0 and if you want to create a 2d array with the first array your X_0s then creating an N + 1 array makes sense. your matrix example is totally bizarre though. the top left of a matrix A is always A_(1,1). so not sure what a[0,0] means. a 1x1 matrix is always 1 element, which is a[1,1]. the number of elements in a mxn arr…
In maths notation it usually is, yes, but in a zero-based language it's usually a[0, 0] (and I've seen maths and CS papers where it's 0, too). The number of elements in a mxn array is still m*n, but the indices don't go that high. For example, in Python you'd loop through m rows with "for i in range(m)", which will go from 0 to m-1 (actually, you might do "for row in a" and not bother with indices). You hardly ever need to do m-1 manually - if you want the last row it's just a[-1, :].
I'm not saying zero-based is always better, but I haven't seen many situations where one-based is preferable.
Re: MoonScript, a programmer friendly language that compiles to Lua
#136Re: MoonScript, a programmer friendly language that compiles to Lua
#137Some of the stuff in Moonscript feels a little overdone and magical, like parens-less function calls and the syntactically significant whitespace - but others really feel like they're fixing the gaps in Lua. Moonscript's nice lambda syntax, ternary operator, default local, implicit return, etc. But I don't think I really needed the ! operator, for example.
fixing the gaps in Lua. Moonscript's [...] default local Roberto Ierusalimschy, the creator of Lua, believes that "Local by default is wrong." [1]. I don't necessarily agree that local-by-default is inherently wrong, but every implementation of local-by-default that I've seen has had flaws. It looks like MoonScript is no different - its scoping rules seem to suffer from the same "madness" as CoffeeScript [2]. [1] htt…
Re: MoonScript, a programmer friendly language that compiles to Lua
#138moonscript powers the itch.io indie marketplace - the original announcement has a quick write-up: http://leafo.net/posts/introducing_itchio.html After spending years working with Ruby or Java, it was a very nice change of pace. Lapis (leaf's web framework) is crazy good as well: it's easy to write fast code, see this article on coroutines: http://leafo.net/posts/itchio-and-coroutines.html (disclaimer: I work there wi…
Re: MoonScript, a programmer friendly language that compiles to Lua
#139Earlier quoted context omitted.
Yes there are many algorithms that are naturally 0 indexed. But there are also many that are naturally 1 indexed! This is somewhat unscientific, but I once went through the first quarter of an algorithms textbook. And counted how many were naturally one based or zero based. And on most it didn't matter, but there were slightly more one based ones.
Can you give us some examples of one-based algorithms? I've done a lot of programming in one-based languages, and now avoid such languages as much as possible (sometimes have no choice) because nothing seems to naturally fit into that.
A Braun tree is a binary tree that represents a flexible array (indexable everywhere and extendable at both ends). The gist of it is that you take your array index and read it as a binary string that tells you how to go down the tree. If your index is 1, then you're at the right place and you stop. Then you go left/right depending on whether the remainder is 0/1. That is the 1-based interpretation, and it works because 1 is in the first digit while 2 and 3 need the next digit as well.
If you want to use 0-based indices, it doesn't work out as cleanly, because 0 and 1 share the same digit, while 1 and 2 use different digits. So now you have to branch on whether your index is odd or even, and then either (i-1)/2, or (i/2)-1.
It's not a big deal either way, but it turns a simple to visualize data structure into one where you have to think about the indices.
Re: MoonScript, a programmer friendly language that compiles to Lua
#140Hey all, I made MoonScript about 6 years ago. I used it to build a ton of opensource stuff in addition to the company I founded. I use it every day and I'm very happy with how it's turned out. I regret not updating the language more frequently, but I've been busy building a bunch of stuff in it. The biggest open source project is a web framework for Open Resty: https://github.com/leafo/lapis It's used for the followi…
The font you are using looks broken to me. (Win 10, Firefox) At 100% scaling, every "i" clearly looks like a "1". It reads "MoonScr1pt" for me: https://i.imgur.com/Ti12E5I.png If I zoom in or out in the browser the i looks ok again.
Win 10, Chrome 58