[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RES: sugarcubes for me.my.self.and.I [Re: Lua OOP initiative]
- From: André de Leiradella <leiradella@...>
- Date: Sun, 16 Jan 2005 14:07:17 -0300
> 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