[Laszlo-dev] defining classes in any order in LZX
J Crowley
jcrowley at laszlosystems.com
Wed Feb 11 13:59:12 PST 2009
Sounds like a good idea. I think it hasn't been a problem because it
seems like most people tend to put their classes in separate files
(which are then typically included at the lexical beginnings of other
files containing classes that extend them), but it could be useful, and
would allow that flexibility for developers who are used to being able
to do that with other object-oriented languages. How significant a
compile slowdown would there be from adding that initial pass? I can't
imagine it would be much.
Henry Minsky wrote:
> Currently the way the LZX compiler works, this code gives an error
> "undefined superclass foo for class bar"
>
> <class name="bar" extends="foo"/>
> <class name="foo"/>
>
>
>
> because the compiler parses classes internally in the lexical order
> they occur in the source, and foo is not defined
> yet when it tries to compile bar.
>
> However, we could make the compiler do a pass that stores the class
> declarations and parses them on demand
> so that the order you declare them lexically doesn't matter.
>
> I guess we've gotten this far without the compiler doing this for you,
> but I'm wondering if it would
> be a useful thing to do, considering that other object oriented
> languages generally seem to allow
> it.
>
>
More information about the Laszlo-dev
mailing list