lua-users home
lua-l archive

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


> On Wed, Nov 24, 2010 at 12:31 PM, Gunnar Zötl <gz@tset.de> wrote:
> > I would consider this entire matter to be a case for something like
> metalua, not for the core syntax.
> 
> and there the syntax is |x| x+1, etc.
> 
> Fair enough; is the problem here that we are using strange symbols?

in a way... yes. For me, it is about consistency. I do see the problem people are trying to tackle here, but I fear all solutions proposed so far open an entirely different can of worms.

> Would an explicit lambda keyword help?

not sure. What yould be the semantics of this? A lambda defining a one-expression function? Because, if you go

lambda(x) do something_with(x) end

that really is not shorter or more concise than function(x) something_with(x) end... but in the case of a one expression function, you would have to think about multiple value returns and stuff, probably resulting in an end delimiter for the lambda statement, which for consistencys sake should be end, in which case nothing is really won, or lambdas only being able to return one value, which would be somewhat weird.

I dunno, I think it would be a proper start to determine what is actually wanted here. There seem to be two major use cases that keep coming up, one being delayed evaluation as illustrated in a previous post, and one being the ability to define function arguments to other functions in place. Maybe they should be tackled separately.

To be honest, I haven't given this matter the necessary bit of thought, because I think it will go away, as usual ;) I ignored the thread until the "dissident" view came along, which, in my opinion, is probably not all that dissident. But, having kinda joined in now, some sort of excuse for a proposal from me might be to actually implement some form of delayed evaluation, and leave function definition as it is. I kinda like the delayed evaluation thing, but I still think short function definitiion things, at least as proposed so far, should not be part of the core syntax. Yes, because they're ugly.

Gunnar