[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal: table.sort returning the sorted table.
- From: David Kastrup <dak@...>
- Date: Mon, 11 Apr 2011 15:01:51 +0200
Henning Diedrich <hd2010@eonblast.com> writes:
> On 4/11/11 12:47 PM, steve donovan wrote:
>
>> 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.)
>
> I heard in some other quarters it's called schönfinkeln and is all the
> hype.
>
> Seriously, this is not a sin to everyone.
Nothing is a sin to everyone, and yet nobody wants to live in a world
where nothing is a sin to anyone.
--
David Kastrup