lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Sep 6, 2013 at 11:07 PM, Paul K <paulclinger@yahoo.com> wrote:
> It would be productive to take Crockford's list of the "awful parts" and "bad parts" of JS and compare the two languages on them

I've attempted something similar with my "Good, bad, and ugly parts":
http://notebook.kulchenko.com/programming/lua-good-different-bad-and-ugly-parts,
although it's not Lua vs. _javascript_ comparison. There is also Lua vs.
_javascript_ on SO:
http://stackoverflow.com/questions/1022560/subtle-differences-between-_javascript_-and-lua

> (note that Crockford considers the presence of a continue statement to be one of the bad parts).

I noticed the same thing about "continue". It's indeed interesting
that it's in "bad" parts for JS, but it's often mentioned as missing
in Lua (I put the lack of "continue" in the "different" category).

Paul.

On Fri, Sep 6, 2013 at 5:46 PM, Eric Bohlman <ericbohlman@gmail.com> wrote:
> On 09/06/2013 06:17 PM, Rena wrote:
>>
>>
>> I usually describe Lua as "like _javascript_ but sane".
>>
> They are in fact quite similar languages: they're both members of both the
> Algol and Lisp families, owing as much to Scheme as they do to C; they both
> use prototypal inheritance; they were both originally intended to be
> embedded in larger programs written in "systems" languages and have
> established major niches in that use, while still being useful as
> general-purpose languages. I think of JS as Lua's little brother, who at
> first appeared to have hopeless developmental delays but has recently
> undergone a major growth spurt.
>
> It would be productive to take Crockford's list of the "awful parts" and
> "bad parts" of JS and compare the two languages on them (note that Crockford
> considers the presence of a continue statement to be one of the bad parts).
>
>


Lacking continue in Lua is one of those things that's always bothered and baffled me, especially as it has break already. You can use goto, but what's easier to read, a statement that means "advance to the next iteration of the loop" in several languages, or a goto, where you have to seek down to the end of the loop to find the target, which then takes you back to the beginning?

BTW, I spot a typo:
> Powerful heterogeneous tables that store values of any type (except nil) and can be indexed by values of any type (except nil): [1, 2, 5, foo = "bar", [func] = "something", ["some spaces"] = value()].
That's not a table constructor...

--
Sent from my Game Boy.