lua-users home
lua-l archive

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


On Mon, Apr 11, 2011 at 12:17 PM, David Kastrup <dak@gnu.org> wrote:
> Intelligence needs restraint, or its potential is locked away behind the
> event horizon of incomprehensibility.

Amen!

In particular, chaining functions with this kind of side-effect is
always a recipe for potential disaster.

l2 = l1:sort():map(string.upper)

Quick question: has l1 been modified?

You have to be awake with this apparently simple expression if the
methods have mixed semantics, e.g if sort() modifies its object
in-place and map returns a new list.  (Naturally, I have been guilty
of this sin before.)

steve d.