lua-users home
lua-l archive

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


> On Tue Dec 18 2012 @  4:13, Pierre Chapuis wrote:

>> That being said I agree that these primitives are being abused a lot in
>> Lua. Its style is mostly imperative, embrace it or use a Lisp...
>
> I'm confused: which primitives do you mean?

I shouldn't have written primitives, I mean functions like map(), filter()
and so on which are usually primitives in functional languages (but
which are not in Lua).

> And how are they being abused?

As I said I think using things like map and filter is OK when they are used
as expected. For me, map() is not a generic replacement for iteration, it is
a way to apply an operation to a vector type, so using map() to print a
list is strange.

> The last sentence seems a little extreme to me: isn't it a strength of Lua
> that (1) it can be augmented easily and (2) it handles multi-paradigm
> programming easily?

No, it is true, and you are right, this sentence is too extreme ;)

You can definitely use the style / paradigm(s) you want in Lua, its is one
of the reasons why I like it too. But another reason is the simplicity and
readability of its "standard" imperative style which works very well for
most problems. More "abstract" paradigms like FP or OOP are useful
sometimes though, and I use them when I need them.

Also, when I use Lua modules I prefer if they do not depend on a huge
functional programming library just because the author wanted to use
filter()...

-- 
Pierre Chapuis