Re: [ANN] Microlight (was Re: paving cowpaths with libraries)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: [ANN] Microlight (was Re: paving cowpaths with libraries)
 
- From: Ross Bencina <rossb-lists@...>
 
- Date: 2012年2月20日 22:16:39 +1100
 
On 20/02/2012 5:30 AM, Dirk Laurie wrote:
The List metatable would contain the standard table library and some ml
functions, plus 'sorted' (so that L:sorted() not only sorts L, but also
returns it).
Playing the naming game:
Qt has this convention where verbs like sort() are mutators that act on 
the instance (ie the name means "_sort_ myself", adjectives like 
sorted() return a sorted *copy* of the collection (ie the name means 
"return a _sorted_ version of self" it's an adjective). Other examples: 
translate(), translated().
I like this convention, just just because I'm a heavy Qt user, but 
because it makes sense.
I would find it kind of weird if sorted() just returned a copy of self, 
if that's the desire, I'd say it's better to have sort() return itself. 
sorted() should make a sorted copy.
Just my two cents.. take or leave,
Best wishes
Ross.