[Laszlo-dev] For Review: Change 20081021-dda-p Summary: Add return type declarations to SWF9 [2nd review]
Donald Anderson
dda at ddanderson.com
Fri Oct 24 13:00:13 PDT 2008
Okay - it's bigger than I have time to do this time. It will be in a
JIRA, with a TODO to mark the spot.
Thanks.
On Oct 24, 2008, at 3:46 PM, P T Withington wrote:
> I see. Two different issues.
>
> 1) As André reminded me, we already have a bug, LPP-6884, to fix the
> (void 0)/undefined issue. That is, we just want `undefined` to be
> an immutable constant in LZX, like it will be in future
> Javascripts. It is a bug in JS1 that it is not.
>
> 2) AS3 does not allow you to to return `undefined` from a function
> that has a subtype of Object as a return type. You either have to
> return an object of the appropriate type or null. But, at least in
> the databinding case, it appears from the smoketest that there is a
> contract to return `undefined` if a datapath matches nothing (or is
> erroneous). So that says to me (for whatever datapath call is
> involved in that particular test case) the return type should not be
> `String`, but must be `*` (or `(String | void)`, if that were
> permitted), so that you can return `undefined`.
>
> Until LPP-6884 is fixed, it seems you will have to conditionalize
> the return on the runtime, although fixing LPP-6884 should be fairly
> easy. If you look at the class VariableReference, you will see it
> already tries to head you off from assigning to 'undefined'. We
> could just go one step further and for the JS1 backends, if you use
> 'undefined' as an r-value, translate it to (void 0), ensuring that
> it is a constant. And, while you're there, you might as well handle
> NaN and Infinity.
>
> On 2008-10-24, at 15:17EDT, Donald Anderson wrote:
>
>> Well, I'll file a JIRA on this (and the other items), but I'm also
>> confused.
>>
>> I could change the String functions in LzDatapointer.lzs to return
>> undefined
>> on any new return paths, and revert the smoke testcase.
>> This is what I did in the first review. That compiles on all
>> runtimes, and allows
>> the tests to pass unchanged. I was under the impression that
>> this was not desirable - you said:
>> `undefined` may be undefined in as3, but it is not in js1, so we
>> can't rely on that.
>>
>> On the other hand, 'void 0' is not allowed, it gives a SWF9
>> compilation error.
>>
>> - Don
>>
>> On Oct 24, 2008, at 1:33 PM, P T Withington wrote:
>>
>>> On 2008-10-24, at 13:20EDT, Donald Anderson wrote:
>>>
>>>> The 'String returns null' case exposed a bug in test/smoke/
>>>> regression.lzl
>>>> where an 'undefined' was expected, changed to a null expected.
>>>
>>> This is the main change that I think is potentially wrong. I am
>>> ok with it as a temporary work-around, but would like a p0 bug to
>>> revert the test and find the cuplrit. I think there is a place
>>> where you need to relax a return type so you can return (String |
>>> void) and return undefined on error.
>>>
>>> IWBNI you also filed Jira's for the other TODO's you mention.
>>
>>
>> --
>>
>> Don Anderson
>> Java/C/C++, Berkeley DB, systems consultant
>>
>> voice: 617-547-7881
>> email: dda at ddanderson.com
>> www: http://www.ddanderson.com
>>
>>
>>
>
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-547-7881
email: dda at ddanderson.com
www: http://www.ddanderson.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20081024/cd9b47fc/attachment.html
More information about the Laszlo-dev
mailing list