[Laszlo-dev] Need uniform naming scheme for classes

P T Withington ptw at pobox.com
Tue Mar 11 05:13:21 PDT 2008


I need to be able to name both user classes and built-in (LFC) classes  
from their corresponding tag name.  In JS1 we can get away with  
(effectively) saying:

<class name="usertag" extends="anothertag"> ...

maps into:

class <unique prefix> + usertag extends ClassMap[anothertag] { ...

but that is clearly not legal JS2.  [We need the unique prefix to keep  
the class from shadowing any runtime class, e.g., the user class  
`window` would shadow DHTML `window` otherwise.  In JS2 we can use a  
namespace for this purpose.  We could extend the JS1 translator to  
fake namespaces, but I don't want to take on that task at this point.]

In the LFC there is a mapping from tag name to class name `view`  
becomes `LzView`.  I'm not completely opposed to continuing that  
practice, but I would prefer using our new convention of `view`  
becomes `$lzc$view` because:  a) the leading `$` indicates that this  
is not a public name, b) the interior `$` serves to delimit the prefix  
from the tagname making it easier to unparse, and c) it is closer to a  
namespace syntax.

Comments?  Is this a useful change to make, or am I just making work  
where it is not necessary?


More information about the Laszlo-dev mailing list