Subject Re: embedding Lua as procedural language
Author woodsmailbox
> I don't quite understand what you mean by expression power. APL,
for
> example, was a very expressive language, but a really bad language
> nevertheless.
>
> When I mean by expressive is the richness of the data structures
handled
> by the language. The JavaScript Object and the Lua table are more
less
> equivalent. The inheritance feature of JavaScript, in my opinion,
gives
> it an edge over Lua.

Expressive power boils down to doing more work with less code. So you
can imagine how long a talk this can get. So I don't quite know where
to start, or whether to start at all. Besides there's plenty of that
on the net.

What do you mean by richness of data structures? There's just one data
structure in the relational model, and it doesn't seem to care for
more since the others are just subsets of it. Or isn't that what you
meant?

> >
> >> JavaScript has exception handling, which Lua does not.
> >>
> >
> > http://www.lua.org/pil/8.4.html
> > This not good? I can only see a problem of familiarity.
> >
> No, that's not good at all. It's a kludge to get around a missing
> feature. I don't want to force people to have to invent their own
> language layered on top of other languages.
>
> Exception handling is a very strong feature that should be built in
to
> languages, not layered on by programming convention. C, it can be
> argued, has exceptions if every function returns a boolean
indicating
> whether it worked on not. A certain unmentionable open source
database
> product does that. It makes the code difficult to read and write
and
> leads to all sorts of problems.

I think you're making a confusion between extending a language and
just infering that a feature is there by programming convention, like
with your C example, or worse, coding it using a language with no extensibility features.

So for instance, you can code OOP full of inheritance, encapsulation,
exceptions, almost any OOP features on top of lisp (or scheme or, to
some extent, lua), and the result is a language in which *you cannot
tell the difference* between a built-in feature and a coded one
(that's another argument for expressive power btw).

In static languages (compiled, static types, mostly imperative
constructs, etc.) you have no extensibility framework to even dream of
such extending, so obviously it makes a kludge to extend such a
language, because the extensions are *not transparent*.

That creates a big mentality gap between how you approach languages
like lisp or haskell or lua, and how you approach C or Pascal or php
in regard to what you can code "in them".

For the former bunch, extending the language is *the designed
approach* to using that language, while for the latter bunch, you'll
just be "getting around" missing features, like you said. You can see
lua as php-like or lisp-like, but that depends more on your perception
(style, background) than on the language itself.

All that being said, if you read the post about Lua exceptions again,
you'll see the difference.

> Uh, 97.6% of languages do name resolution during compilation.

... maybe 97.6% of *compiled* languages, but that leaves another
12345.6% of *dynamic* languages out of discussion... weren't we
talking about those?

> > Now back to my advocacy: my reason for Lua is the good impedance
match with the
> > relational model because of a core feature: tables. Not even php
(indexed arrays of
> > assoc. arrays?), python (lists of dictionaries??), javascript (??)
is so close.
> >
> That's ridiculous. Lua's table have nothing at all do with
relational
> tables except a common name. The same argument could by made by
> JavaScript by changing the name of "Object" to "Table"

Ugh. That's a long one. Hope I'll find the time to argue that out. But
until then, could you please tell me how do you plan to represent a
"rowset" with a javascript object?