[Laszlo-dev] LPP-6098: JS2

P T Withington ptw at pobox.com
Thu Jun 5 05:15:18 PDT 2008


On 2008-06-05, at 07:53 EDT, Lou Iorio wrote:

> dguide: Language Preliminaries
>
> http://labs.openlaszlo.org/trunk-nightly/docs/developers/language-preliminaries.html

That needs some editing.  I guess I need to take a copy, mark it up,  
and send it back to you.  There is nothing _horribly_ wrong with it,  
but it has some errors and lacunae.  It would also be a good spot to  
explain that we have adopted the JS2 class mechanism (because it  
closely matches the LZX class mechanism).  We could also dispense with  
the malarky about implicit "this" and "with" as that is the default  
behavior in JS2 class instance functions [methods for you Java fans]  
(instance variables are in scope in method bodies).

> dguide: ECMAScript
>
> http://labs.openlaszlo.org/trunk-nightly/docs/developers/ecmascript-and-lzx.html

The main issue here is that this is telling what of es3 we don't  
support.  It needs updating because we now _do_ support exceptions on  
all runtimes (thanks Don!).  Someone would need to revisit this table  
and make sure it reflects the lowest-common-denominator ES3 feature  
set (swf7/8 support being the limiting factor).  No one will go wrong  
with the current table, it is just over-conservative.

This would also be the right spot to give a detailed description of  
what es4 features we _do_ support.  For es4, it makes more sense to  
list what we do have than what we don't since that is the smaller set.

If you want to take a stab at it, you could read the es4 overview and  
try to extract from that how class delcarations, type annotation, and  
parameter lists work.  But again, I don't think this is _crucial_ to  
the LZX programmer because all of these things are optional.  Since we  
advise people if they have a choice to program in LZX, they really  
should be using LZX not JS, so they should not need to know about the  
additional features of JS.

I guess LPP-6098 is concerned mostly with the fact that we have used  
the ES4 syntax for type annotation in documenting our API's.  It just  
seems intuitive to me, but perhaps we need a sentence somewhere to say  
that when we say:

name:Type

that is saying that the variable `name` will be of type `Type`.  (And  
that in some runtimes, you will get a compile or runtime error if it  
is not.)

> On Jun 5, 2008, at 7:44 AM, P T Withington wrote:
>
>> [cc-ing Don, Laszlo-dev:  feel free to pitch in here!]
>>
>> On 2008-06-05, at 06:12 EDT, Lou Iorio wrote:
>>
>>> http://www.openlaszlo.org/jira/browse/LPP-6098
>>>
>>> From JIRA:
>>>
>>> "JS2 is not explicitly mentioned anywhere as far as I can tell,  
>>> but each method declaration uses JavaScript 2-style type  
>>> declarations. JS2 and typing would likely need to be added to the  
>>> "Language Preliminaries" section of the dev guide. It currently  
>>> contains obsolete information in the JavaScript section and should  
>>> be updated to mention that JavaScript in LZX supports a set of JS2  
>>> features."
>>>
>>> Currently, we say this in the Language Preliminarys chapter of the  
>>> dguide:
>>>
>>> LZX incorporates a partial implementation of the ECMA-262 Edition  
>>> 3 specification.
>>>
>>> We also provide a history of JavaScript and ECMAScript that seems  
>>> like too much detail to me.
>>
>> URL?  I don't know my way around the doc like you.
>>
>>> The chapter ECMAScript in the dguide provides a lot more,  
>>> including the differences between LZX
>>> and ECMAScript.
>>>
>>> Has this changed? What should we really say?
>>
>> Give me an URL and I'll tell you.  I think I updated this page  
>> recently, as it used to basically be a list of the ES things that  
>> we could not support on swf5.  What LPP-6098 is complainint about  
>> is that we have added a small subset of the things being proposed  
>> for JS2/ES4.  Unfortunately, this is not a standard yet, so we  
>> can't just reference it (drafts exist: http://www.ecmascript.org/es4/spec/overview.pdf) 
>>   In particular, the things we have added include:
>>
>> 1) Class declarations
>>
>> 2) Type annotations
>>
>> 3) Additional operators: `is` and `cast`
>>
>> 4) Optional and rest parameters for functions
>>
>> [There may be others, but that's what came off the top of my head.]
>>
>>
>



More information about the Laszlo-dev mailing list