lua-users home
lua-l archive

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


On 10 April 2011 16:45, Dirk Laurie <dpl@sun.ac.za> wrote:
> On Sun, Apr 10, 2011 at 08:37:25AM +0200, Lorenzo Donati wrote:
>> >
>> Yes. I know that. But I avoid like the plauge to redefine standard
>> libraries functions (even in short scopes - it's about readability).
>>
> Python does the various sorting options neatly: a.sort() sorts a in
> place, sorted(a) returns a new array containing the sorted version
> without disturbing the original.  OK, Python is a fat API, but that
> sort of distinction aids clarity.
>
> Your argument against Sean's local redefinition of table.sort() does not
> apply to making a new table.sorted().

I have the same hate for wrapping/modifying standard library functions
so I (for what it's worth) prefer this solution also. Incidentally I
came from a python background so this seems natural to me.

>> The argument of Luiz, while in general is really sound
> As arguments of Luiz and Roberto tend to be :-)
>
> Dirk