[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: table.sort & __call?
- From: "Mark Meijer" <meijer78@...>
- Date: Tue, 12 Feb 2008 11:40:28 +0100
I think the "callable" thing is exactly in the spirit of Lua's
extensible semantics. And considering Lua's usual consistency and
"behave as expected" mentality, it seems rather awkward to me that
__call works in some cases but not in others.
Just my 2 cents :-)
On 12/02/2008, Ben <email@example.com> wrote:
> Well, I stand corrected! :)
> I guess in this situation there is a disconnect between the table.sort
> behavior and iterator behavior.
> *reads up the thread*
> On Feb 11, 2008 7:32 PM, Eric Tetz <firstname.lastname@example.org> wrote:
> > On Feb 11, 2008 6:30 PM, Ben <email@example.com> wrote:
> > > Back to the point, callables and such... seem against the Lua Way from
> > > what I see
> > I think in particular case, not enforcing type is more the "Lua Way".
> > As I mentioned earlier, Lua doesn't care about the types of values in
> > a table to be sorted. As long as the values being compared are the
> > same type and support the < operator, they can be sorted. That kind of
> > generic programming is one of the great strengths of dynamically typed
> > languages. Writing a similarly generic sort function in, say, C++
> > requires the use of templates or a class hierarchy.