[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: table.sort & __call?
- From: Ben <thebassplayer@...>
- Date: Mon, 11 Feb 2008 19:46:03 -0800
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 <email@example.com> wrote:
> On Feb 11, 2008 6:30 PM, Ben <firstname.lastname@example.org> 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.