lua-users home
lua-l archive

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


> seems like most if not all calls for core changes in
> this area just want the parser to add yet more sugar.
> 
> In other words, it should be possible to implement
> "lua++" as a "luafront" preprocessor
> -- and you can even add <templates> :)
> without touching the core

I did it:

A = class(B)

function A.constructor(name)
	@name = name -- translates to self.name = name
end

function A.id()
	return 'My name is ' .. @name

function A.toString()
	return @id() -- translates to self.id()
end

function A.draw()
	@@draw(...) -- translates to inherited('draw', self, ...)
end

But I just hate the @s. I'll need to implement a complete parser to
analyze the lexical scope of identifiers and decide if they're local
variables, members of the class or globals... It's sad that Lua has
obviously a complete parser that would need small changes to implement
that.

> cheers

Regards,

Andre de Leiradella