[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua for large apps (was: Lua for GUI toolkit wrapping?)
- From: steve donovan <steve.j.donovan@...>
- Date: Mon, 28 Sep 2009 14:22:42 +0200
On Mon, Sep 28, 2009 at 2:35 AM, Thomas Harning Jr. <harningt@gmail.com> wrote:
> managed through accessors. Now... if you have a typo when accessing
> members of tables, that can be problematic.. though it's less likely
> than typos when accessing items you intend to be in local-scope.
With a little discipline, field name typos can be caught usefully:
http://lua-users.org/wiki/StrictStructs
e.g.
struct.Point {X = 0, Y = 0}
p1 = Point() -- defaults to {X=0,Y=0}
p2 = Point {X=2,Y=10}
print(p1.x) ---> oops! No such field!
The other advantage is that it encourages developers to name all those
anonymous data structures which we create so happily and then struggle
to document.
steve d.