Lua and Javascript

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua and Javascript

whisper-4
I'm continually struck by the resemblence between the two languages. Is
there a relationship?

DAve LeBlanc
Seattle, WA USA
Reply | Threaded
Open this post in threaded view
|

Re: Lua and Javascript

Roberto Ierusalimschy
> I'm continually struck by the resemblence between the two languages. Is
> there a relationship?

No, as far as we know.

(By the time Javascript was born [circa 1996], Lua already had most of
its "object model" in place.)

-- Roberto
Reply | Threaded
Open this post in threaded view
|

Re: Lua and Javascript

Mark Hamburg-4
Possibly some common ancestry (with respect to object models) with Self?

Mark

on 5/8/06 8:50 AM, Roberto Ierusalimschy at [hidden email] wrote:

>> I'm continually struck by the resemblence between the two languages. Is
>> there a relationship?
>
> No, as far as we know.
>
> (By the time Javascript was born [circa 1996], Lua already had most of
> its "object model" in place.)
>
> -- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: Lua and Javascript

Bret Victor
In reply to this post by whisper-4
 <whisper <at> oz.net> writes:

> I'm continually struck by the resemblence between the two languages. Is
> there a relationship?

Lua is Javascript done right.  Javascript is Scheme done wrong.  :)

-Bret




Reply | Threaded
Open this post in threaded view
|

Re: Lua and Javascript

Roberto Ierusalimschy
In reply to this post by Mark Hamburg-4
> Possibly some common ancestry (with respect to object models) with Self?

Sure.

-- Roberto
Reply | Threaded
Open this post in threaded view
|

Re: Lua and Javascript

Javier Guerra Giraldez
In reply to this post by Bret Victor
On Monday 08 May 2006 2:12 pm, Bret Victor wrote:
>  <whisper <at> oz.net> writes:
> > I'm continually struck by the resemblence between the two languages. Is
> > there a relationship?
>
> Lua is Javascript done right.  Javascript is Scheme done wrong.  :)

that hits the nail!

in fact, since the first question, i've been trying to put into words how much
i find javascript horrendous, easily the language i find most hard to swallow
(even after doing some dabbling in Perl).

after realizing how much of the language theory is shared with Lua, i find
that i can actually write some short JS stubs... but the pain is still there.  
why? i still don't know.

i put most of the blame in the pseudo-java syntax (which is a pseudo-C syntax
itself).  note that, after Lua, the language i like best is C...

so, i think that C syntax is right for low level languages, where you have to
keep track of pointers, and do your references right; and for scripting
languages, where everything is how it should be (instead of how it's easier
for the machine to execute), the syntax have to be different, with much more
thought into aesthetics.

--
Javier

attachment0 (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Lua and Javascript

David Given
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Javier Guerra wrote:
[...]
>> Lua is Javascript done right.  Javascript is Scheme done wrong.  :)
>
> that hits the nail!
>
> in fact, since the first question, i've been trying to put into words how much
> i find javascript horrendous, easily the language i find most hard to swallow
> (even after doing some dabbling in Perl).

Search the list for my earlier rant on Javascript's Array class...

I found something else about Javascript I loathe: when you call something, the
value of 'this' in the called thing depends on how you call it.

new Fnord() --- calls function Fnord() with this set to a new object.
wibble.fnord() --- calls function Fnord() with this set to wibble.
fnord() --- calls function fnord() with this set to whatever it was before (I
think, I could be wrong about that).

...which can lead to all *kinds* of obscure bugs! Lua's behaviour where self
is passed around explicitly is so much nicer... it's interesting that two
languages that are so similar are so different to program in; I'm not entirely
sure why.

...

It occurs to me that there might be a niche for a strongly typed language that
compiles *into* Lua or Javascript code (easy enough to support both). I doubt
you'd be able to easily support either language's level of dynamicism, but for
writing big, standalone apps I'd certainly find it useful. Hmm --- I must
think about that...

- --
+- David Given --McQ-+ "If you're up against someone more intelligent
|  [hidden email]    | than you are, do something insane and let him think
| ([hidden email]) | himself to death." --- Pyanfar Chanur
+- www.cowlark.com --+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEX8dff9E0noFvlzgRAkSgAKCUUwVqqhH2HU8wVFCoCRxBvlCOAQCgy0VY
c01lDBRMBPGONG3t9vFxOWk=
=zJ3x
-----END PGP SIGNATURE-----