Live data from Hacker News

Fengari – Lua for the Browser

fengari.io

121–130 of 145 posts

Re: Fengari – Lua for the Browser

#121
post #37

Earlier quoted context omitted.

> basically no confusing elements. the one confusing element - one-based indexing of arrays! that is something i found hard to adjust, as it makes off-by-one errors more prominent... but otherwise it's a nice language.

iirc, one other confusing element is that tables (hash tables? I don't remember what they're called) return null when a lookup is done for a nonexistent key. This is not necessarily a bad choice. Exceptions and such can be a real pain. However, accidentally getting a null value because you didn't check and then have it propagate much further in your program is extremely difficult to debug. Instead of blowing up at th…

Give Teal [1] a look. It’s basically typescript for Lua

https://github.com/teal-language/tl

Re: Fengari – Lua for the Browser

#122
post #37

Earlier quoted context omitted.

It has all the power of something like Python, but is much faster and with far less cruft and basically no confusing elements. You’re given a small set of tools and it’s incredibly easy to build off them.

> basically no confusing elements. the one confusing element - one-based indexing of arrays! that is something i found hard to adjust, as it makes off-by-one errors more prominent... but otherwise it's a nice language.

If you work with pure Lua that’s a non issue. The ipairs function abstracts that away, and for numerical loops are written different than in C, with a start value (included), an end value (included) and a step (optional), and no exit condition. You can’t put iAgreed that interaction with C or other 0-based languages or systems (eg screen coords) makes things more difficult.

Re: Fengari – Lua for the Browser

#123

Earlier quoted context omitted.

This is not breaking an API or the implementation. It is not a refinement. This is a change to the language itself. If you had a published standard it would be a change and not an addition.

Was the release of C11 a fork of the C language, since they removed the gets() function?

A change in a library is not a change of the language. So definitely no.

Re: Fengari – Lua for the Browser

#124

Earlier quoted context omitted.

IIRC Google made a version of Chrome with a Dart VM quite a while ago https://www.cnet.com/news/googles-dart-language-arrives-in-c... and they cancelled it ... my interpretation of their reasons are unless all browsers ship it it's a problem. https://news.dartlang.org/2015/03/dart-for-entire-web.html

Foe anyone interested, there was a port of Webkit/Blink where the web objects retained by javascript are garbage collected outside of V8, using blink GC to destroy those objects. The way it works its through smart pointers, where for instance you say how the reference to that object is retained according to the object that it references. The good side of this is that other programming languages besides Javascript can…

Is this still possible in Blink? Or was this feature abandoned?

Re: Fengari – Lua for the Browser

#125

Earlier quoted context omitted.

Not sure why'd you think this would have anything to do with WASM, the homepage is really clear what this is: > Fengari is the Lua VM written in JavaScript. It uses JavaScript's garbage collector so that interoperability with the DOM is non-leaky. WASM wouldn't use JS's GC, nor would provide interop with the DOM, so for the stated goals of this project, WASM would be a non-starter. There is prior art for Lua -> WASM…

Vanessa Freudenberg's brilliant SqueakJS, a Squeak VM in JavaScript, also layers a Smalltalk VM on top of JavaScript in a way that efficiently and elegantly interoperates with JavaScript's garbage collector, because trying to layer one garbage collector on top of another garbage collector would be a disaster. https://squeak.js.org/ HN discussions: https://news.ycombinator.com/item?id=29018465 https://news.ycombinator…

Err, while squeakjs is impressive (and I have spent quite a while doodling within it, using old squeak images, and current cuis images), one cannot in good conscience call it "fast".

In fact, if keeping one eye on the truth, then one couldn't call it "slow" either.

If performance IMPROVED by one order of magnitude, then you could call it "slow".

Re: Fengari – Lua for the Browser

#126

Earlier quoted context omitted.

Was the release of C11 a fork of the C language, since they removed the gets() function?

A change in a library is not a change of the language. So definitely no.

Okay, will the release of C2x be a fork of the C language, since it's going to remove support for K&R function definitions (and not every such function can be rewritten to use the new style)?

Re: Fengari – Lua for the Browser

#127
post #49

Earlier quoted context omitted.

I'm not entirely sure what you mean by "language fork", but all versions of Lua have incompatibilities. 5.1, 5.2, 5.3, and 5.4 are all major versions, with features that aren't completely compatible with any of the others. For example, 5.2 brought in major changes for how environments were handled, and 5.3 brought in integers, and 5.4 brought in changes to how number overflow is handled.

At 5.3 the behaviour of the basic arithmetic operations were changed in a fundamental and non-backwards compatible way to bring in those integers. That certainly counts as a language fork, as opposed to the other two examples.

In 5.2, environments were changed in a fundamental and non-backwards compatible way. CFunctions used to have environments, but now they don't. This also affected equality when comparing between function values.

In 5.4, they changed _the way that numbers behave_:

> Literal decimal integer constants that overflow are read as floats, instead of wrapping around.

Which, by the definition used for 5.3 being a fork, would also be a fork. It's a fundamental change of the entire numeric tower.

Re: Fengari – Lua for the Browser

#128
post #37

Earlier quoted context omitted.

> basically no confusing elements. the one confusing element - one-based indexing of arrays! that is something i found hard to adjust, as it makes off-by-one errors more prominent... but otherwise it's a nice language.

I agree, that's the one unfortunate flaw of Lua I'd go back in time and change if I were Hitler With a Time Machine, but I've used Lua and other 1-based languages like ScriptX, and you totally get used to it, and finally realize that 0-based languages have their own confusing quirks and inconveniences that you got used to when you learned them, and you just don't think about them any more once you've internalized the…

> It's just a matter of moving the confusing quirks and complexity around

unless you can exclusively program in 1 language only, these confusions would be the cause of various bugs, or at least, increase the cognitive load. Programming is already hard enough, without artificially increasing the cognitive load!

Re: Fengari – Lua for the Browser

#129
post #72

Earlier quoted context omitted.

> If one likes Python, then the chance of liking Lua are low. I don't know. I quite like both as well. The design ethos feels similar although Python has certainly added more features over the years.

"with" existed in python 2. In python 2.6 in fact, like comprehension lists, decorators, generators, descriptor protocol, exotic slicing assignation, advanced nested unpacking, infinite parameters... Python was always chock-full of advanced features, people just usually don't notice because they get productive in 3 days with the basic features and don't need to go further. It's has the quality of a very smooth learni…

"with" and "defer" (Go) are nice but not crucial to me.

Re: Fengari – Lua for the Browser

#130

Earlier quoted context omitted.

At 5.3 the behaviour of the basic arithmetic operations were changed in a fundamental and non-backwards compatible way to bring in those integers. That certainly counts as a language fork, as opposed to the other two examples.

is every OS version a fork, is every new parliament a new country? there are markers other than backwards compatibility for continuity.

I am claiming a very specific thing, a language fork. Your examples are entirely different things that have nothing to do with computer languages.
Post reply on HN