lua-users home
lua-l archive

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


On Fri, May 9, 2008 at 10:23 AM, David Kastrup <dak@gnu.org> wrote:
> ...
>
> With languages like C++, the complexity of the language (and its appeal
> for "great features") is such that you max out even on simple tasks.
>
> I just had a short exchange with a very skilled C++ programmer who had a
> cursory look at Lua.  One of the things he decried was its lack for
> generics, a stronghold of C++ (supposedly).  I pointed out to him that
> the cost that generics try avoiding (at the price of complexity) has
> already been paid in Lua (by having dynamic typing).  There is just no
> point for generics in Lua: the tradeoff flexibility/performance is not
> there.  Lua always has the flexibility, and you can't get the
> performance.
>
> I also pointed out that the performance loss in Lua is O(1), which is
> much less than the resulting costs from maxing out the programmer's
> capacities.
>
> For example, C/C++ programmers will use linked list representations
> reflexively for about everything unless you kick them in the shin.  Lua
> programmers don't have much of a choice, anyway: they use tables.
>
> Brains are a precious resource in short supply, so you apply them
> strategically.  And that means that the bulk passages of C++ programs
> will tend to be inefficient.  Because one can.

The other day I stumbled upon an old presentation by Peter Norvig
(link at http://norvig.com/design-patterns/). The name may ring a bell
if you have
taken any AI classes at university - his book is very widely used.

It provides some examples of how most design patterns requiring a lot of
elaborate scaffolding in languages like C++ just "dissapear" in dynamically
typed languages like Lua as they just happen to be the natural way of
doing things (he actuallly uses Lisp and Dylan as examples).

The presentation is 10 years old, but still quite interesting read.

Varol Kaptan