lua-users home
lua-l archive

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


> Assume we somehow recognized do as shorthand for creating a function:

I think that 'do ... end' would be better as a 'value-block', that is,
a block that produces a value. Something like
	a = do
		local b=f(1,2)
		local x=g(3)
		=h(b,x)   -- need some way to signal the value of the block
	end
 
As Mark pointed out, using 'return' to signal the value of the block may
be confusing.

This extension would also go well with 'if ... then ... else end' value
expressions:
	m = if a<b then a else b end
It'd be nice to allow locals inside the then and else blocks; in this case
we would need a way to signal the value of the block.

Not that Lua needs either of these... :-)
--lhf