lua-users home
lua-l archive

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


Excuse me, I didn't had time to read your e-mail entirely. But what
you're saying reminds me something I proposed here on the list quite
some time ago:

http://lua-users.org/lists/lua-l/2006-11/msg00547.html

The proposition is to introduce a new syntaxic sugar that would
transform any expression like:


[local] in [ var_a1, ..., var_an = ] var_b1, var_b2, ..., var_bn do
	inst_1
	...
	inst_n
end


in


[[local] var_a1, ..., var_an = ] var_b1(function()
	inst_1
	...
	inst_n
end,
var_b1, var_b2, ..., var_bn)



I think Lua needs something to facilitate creating closures, and the
syntax should be beautiful.

This way, for example one could write:


in myClass = class, parent1, parent2, parent3, ... do
	function method1()
		...
	end
	function method2()
		...
	end
	attribute1 = ...
	attribute2 = ...
	...
done


Someone else could also write:

in local filter = TextFilters.Filter do
	match "(.+/n)+"             -- split into multi-line chunks
	if_find "%%A.*Bimmler"      -- check for author
	match ".+/n"                -- split into lines
	if_find "%%T"               -- find title lines
	print_text()                -- print the current line
end



I don't really care about the syntax in itself as long as it is easy to
read and write, and is clear enough.

Mildred
-- 
Mildred Ki'lya
E-Mail:	mildred593(at)online.fr

Site:	<http://mildred632.free.fr/>
XMPP:	<mildred@jabber.fr> (GoogleTalk, Jabber)

GPG:	197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]