[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: table.sort & __call?
- From: "Eric Tetz" <erictetz@...>
- Date: Mon, 11 Feb 2008 18:12:42 -0800
On Feb 11, 2008 5:30 PM, Javier Guerra Giraldez <email@example.com> wrote:
> On Monday 11 February 2008, Peter Odding wrote:
> > Should the Lua API be extended to (transparently) treat callable objects
> > as functions in the appropriate contexts?
> ultimately, that could end in deprecating the value type concept in favor of
I think that's the point. For instance, table.sort's default
comparator function only cares that the values you are sorting support
the < operator (and are of the same type). You don't need one function
for strings, another for numbers, another for tables, etc. It would
make sense, in terms of consistency, that any instance where a
function is accepted that a callable object is valid.