[Laszlo-dev] case sensitivity in Laszlo

P T Withington ptw at pobox.com
Tue Jan 18 20:21:35 PST 2005


The Laszlo language is based on XML and ECMAScript, which are both 
case-sensitive languages.  However, until recently, the Laszlo language 
has been compiled to Flash 5 or 6 byte codes, and the Flash runtime 
does not enforce case sensitivity for versions before 7 (Flash binaries 
have a target version embedded in them, and the Flash runtime enforces 
case sensitivity according to the target runtime).

We are starting to work on alternative runtimes and on generating Flash 
7 byte codes, all of which will enforce case sensitivity.  This brings 
up several technical and stylistic issues.  Currently:

o In ECMAScript, the types are captialized (e.g., Undefined, Null, 
Boolean, String, Number, Object), by convention, classes are also 
capitalized (e.g., Function, Array, Date).

o XML is also case sensitive, but by convention tags and attributes are 
written in lower case.

o In LZX, we have used XSD types for the type property of attributes.  
The compiler automatically maps a subset of built-in XSD types (e.g., 
string, integer, float, double, boolean, date) to the corresponding 
ECMAScript type or class, so that, for instance, the XSD type "string" 
corresponds to the ECMAScript type "String".

o In LFC (Laszlo Foundation Classes), which are written in ECMAScript, 
classes are defined in capitalized camel case, using an "Lz" prefix.  
There is a compile- and run-time mapping from tag names to classes, so 
that the tags have simple, lower-case names.  E.g., <view ... /> maps 
to LzView.  This mapping is documented by noting the class that 
corresponds to each tag.  This mapping is not extensible.

o In LZX components, we have named our classes using lower case, so 
that the class names corresponded to the tag name.  E.g, <class 
name="button" ... /> defines the tag <button ... />

People are uncomfortable with this complicated story.  Three ideas have 
been proposed for making it simpler:

1. Capitalize all class names, change all tags that are implemented by 
such classes to have capitalized names, e.g., <Canvas ... />, <View ... 
/>, etc.

2. Make up a rule that <class name="foo" ... /> creates a class named 
Foo, but you still instantiate it with a tag <foo ... />.

3. Maintain the status quo.  Create a style guide that suggests using 
lower-case names for classes that define tags.  Create lower-case 
aliases for the built-in types and classes.

Comments?



More information about the Laszlo-dev mailing list