And one more idea.
Would it not be better to have static typing in the future in laszlo
enforced. Because it seems much easier to take the types away during
compilation than to add them. And the compiler could help the developer
more showing some of the type related errors.
- rami
P T Withington wrote:
On 2009-11-19, at 10:17, Rami Ojares / AMG Oy wrote:
We have added some syntax from 'es4'/'as3' (neither of which is an
accepted standard) to support declaring classes, function signatures, > and
default arguments.
Is there any documentation about this?
Unfortunately not. We currently have no resources for documentation.
Basically I have understood that I should continue using javascript 1.5
reference and reading Ecmascript edition 3 specification.
That is the safe thing to do. In general, you don't need to know about the
extensions if you are writing LZX.
Information about edition 4 is difficult to find since even ecmascript.org does
not keep it public.
You can look at the Flex documentation, because edition 4 was closely patterned
on that.
As a basic summary, in OpenLaszlo script, the extensions to edition 3 are:
o You can define classes using the `class` keyword.
Classes compile directly to classes for swf9/10 emulated (using the LFC Class
substrate) on other runtimes.
o You can specify types on var's, parameters, and function return type.
Types are preserved or swf9/10, discarded for runtimes that do not understand
them. Someday we may add runtime type-checking in debug mode for runtimes that
do not have that.
o You can use the default value argument and rest argument syntax.
Default values and rest arguments are preserved in swf9/10 and emulated in
other runtimes.
Your best reference for examples of OpenLaszlo script extensions the source of
the LFC: http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc/