lua-users home
lua-l archive

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


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 :-)

- Mark


On 12/02/2008, Ben <thebassplayer@gmail.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*
>
> Cheers,
> Ben
>
> On Feb 11, 2008 7:32 PM, Eric Tetz <erictetz@gmail.com> wrote:
> > On Feb 11, 2008 6:30 PM, Ben <thebassplayer@gmail.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.
> >
>