News for hackers. Stuff that matters.
Re:Gravity – An embeddable programming language by logimame on Friday June 22, 2018 @10:36AM (#17374243)
Although LuaJIT is crazy fast, it can't be used on iOS, so we first need to compare this with the unJITted version of Lua.

Lua is pretty simple and elegant, but has its woes on being too flexible and wonky (especially with nil and global variables). It also doesn't support OOP syntax directly, so everyone started to create their own wonky class system, which broke easily because of Lua's wonkiness. Gravity seems like a good embedding language packaging a nice OOP syntax with a lot of syntactic sugar (such as properties and access specifiers), so I think some UI/game developers would choose this over Lua.

Re:Gravity – An embeddable programming language by sitkack on Friday June 22, 2018 @11:33AM (#17374747)
>it can't be used on iOS

LuaJIT interpreter which is _faster_ can be used on iOS. So you would use an immature language everywhere because you can't use the fastest implementation on one platform (iOS), when infact, the LuaJIT interpreter is the fastest interpreter of any dynamic language on all platforms.

Wonkiness is not a substantive claim. How do class systems break because of it?

Re:Gravity – An embeddable programming language by TooBrokeToBeg on Friday June 22, 2018 @01:57PM (#17375943)
Magic methods are wonky. Things that get called, although they don't exist, have to traverse an arbitrary system to determine an implementation (may or may not exist). Now add that you can determine that system of traversal, at runtime. Now add arbitrary constraints like 42 local vars per scope, singular inefficient table, no switch (but currying is ok, certainly one of these is more confusing than the other in every CS class) ultimately forcing some wonkiness in every project. It's truly a strange confluence of features leading to an even dumber javascript. I use Lua a lot.
Re:Gravity – An embeddable programming language by samatman on Friday June 22, 2018 @04:59PM (#17377297)
Different strokes I guess.

I consider Lua's type system almost mathematical in its elegance. For my taste, Lua is the penultimate dynamic language, held back only by the unforgivable Wirth-style indexing from 1.

The one place where I simply must correct you is in calling tables inefficient. LuaJIT's implementation, as interpreted, is demonstrably among the fastest general-purpose container classes in widespread use.

Re:Gravity – An embeddable programming language by armitron on Friday June 22, 2018 @01:21PM (#17375682)
Of course it can be used on iOS, there are commercial applications that do exactly that. You can turn off the JIT and you're left with probably the fastest interpreter for a dynamic language that currently exists.

LuaJIT is state-of-the-art even without the JIT. A lot of people miss this and go down various rabbit holes only to come up with something that's significantly worse. Personally, given what I just described, I don't see how Gravity compares at all favorably to Lua.

Re:Gravity – An embeddable programming language by ainar-g on Friday June 22, 2018 @10:49AM (#17374355)
I see your point, although I would probably use something like mruby[1] if I wanted something embeddable and OO.

[1] http://mruby.org/

Re:Gravity – An embeddable programming language by lasagnaphil on Friday June 22, 2018 @11:12AM (#17374557)
I've also looked at mruby, but the language seemed quite complex. (It claims to have a Ruby compatible syntax, but also has its strange warts.) It doesn't help that its documentation is rather poor. Also by looking at the issues section I was pretty scared about the bugs that might come up while using this (https://github.com/mruby/mruby/issues). If there was any successful usage of it in game development I would have jumped in, but so far I haven't found any.
Re:Gravity – An embeddable programming language by api on Friday June 22, 2018 @10:59AM (#17374448)
Can anything interesting be used on iOS?
Re:Gravity – An embeddable programming language by lasagnaphil on Friday June 22, 2018 @11:39AM (#17374811)
There are some nice non-JIT embedded languages such as Angelscript (resembles C++, uses refcounting instead of GC), Squirrel (extension of Lua syntax to support classes and other nice features), and recently Wren (has a nice class system and uses fibers for concurrency).
Re:Gravity – An embeddable programming language by api on Friday June 22, 2018 @11:53AM (#17374943)
Does Apple still prohibit any form of downloaded code or scripting or did they finally ease that?
Re:Gravity – An embeddable programming language by 0xCMP on Friday June 22, 2018 @04:38PM (#17377149)
They do if the user can download and execute the code themselves. If the underlying app uses it (e.g. React Native app downloads updated bundle) and user can't touch it then it's okay.
Re:Gravity – An embeddable programming language by megous on Friday June 22, 2018 @02:39PM (#17376264)
Wren looks interesting. It stands out by the lack of use of setjmp/longjmp for error handling. It's probably side effect of being able to return/suspend fiber from any call stack depth.
Re:Gravity – An embeddable programming language by rurban on Friday June 22, 2018 @05:24PM (#17377507)
Haxe is the leader there, besides swift.