[Laszlo-dev] For Review: Change 20081021-dda-p Summary: Add return type declarations to SWF9
Donald Anderson
dda at ddanderson.com
Tue Oct 21 14:19:50 PDT 2008
On Oct 21, 2008, at 2:33 PM, P T Withington wrote:
> On 2008-10-21, at 13:57EDT, Donald Anderson wrote:
>
>>
>> On Oct 21, 2008, at 1:01 PM, P T Withington wrote:
>>
>>> Great stuff!
>>>
>>> Comments:
>>>
>>> 1) Our idiom for undefined is `void 0`, because of (http://tinyurl.com/2z3q2o
>>> ),
>>
>> On an existing line with 'return void(0);' , I got a flex error
>> about mismatching type.
>
> There are surely plenty of places in our code where we use the idiom
> `void 0` to mean undefined, so the problem must lie elsewhere.
> `undefined` may be undefined in as3, but it is not in js1, so we
> can't rely on that.
>
> `void` is a unary prefix operator that is defined to evaluate its
> operand and return the undefined value. If Flex is whining about
> that, I'd say that's a Flex bug.
>
> The parens are not necessary because `void` is an operator not a
> function and 0 and (0) are equivalent expressions. I used 0 as the
> expression as a nano-optimization (from knowing the byte-codes that
> get generated).
>
FWIW, here's the error I get if I leave return void(0) in this function:
[/tmp/lzswf9/lzgen49569/LzReplicationManager.as: 344] data/
LzReplicationManager.lzs: 485: Error: Implicit coercion of a value of
type void to an unrelated type LzReplicationManager.
--
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/20081021/ca6474b3/attachment-0001.html
More information about the Laszlo-dev
mailing list