[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Another example for syntactically lightweight closures
- From: "steve donovan" <steve.j.donovan@...>
- Date: Thu, 7 Feb 2008 14:04:08 +0200
On Feb 7, 2008 1:52 PM, Alexander Gladysh <email@example.com> wrote:
> You've just made every string callable -- both lambda strings and
> ordinary strings. How would you ensure type-safety now?
The short answer: we can't. The longer answer is that the requirement
that we test our programs carefully means that type-safety is not so
> assert(type(fn) == "function" or type(getmetatable(fn).__call) ==
And if there were other callables hanging around the system, then one
would have to do that as well, there are going to be tables that are
BTW, there is a gotcha to this cuteness. Local variables in enclosing
scopes are not respected, alas. Ultimately we really need syntax for
this kind of thing.