[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: table.sort & __call?
- From: Javier Guerra Giraldez <javier@...>
- Date: Mon, 11 Feb 2008 20:30:46 -0500
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
capabilities.
i mean, a table wouldn't be any different from a function, or a number... just
that if you use {}, an 'indexable' object is created; if you type 143, you
get an 'arithmeticable' object. and function(...)...end returns a 'callable'
object. but if you want, you could create an indexable + arithmeticable
object, or a callable 'number', or whatever you could conceive.
instead of the type() function, we would have several tests, 'callable(v)'
would return true if v() is valid, no matter how it was created.
does it make any sense? i really wonder...
--
Javier
Attachment:
signature.asc
Description: This is a digitally signed message part.