[Laszlo-dev] Mixins in swf9
André Bargull
a.bargull at intensis.de
Sat Apr 19 07:04:20 PDT 2008
But only (public) functions from mixins will be taken for the AS3
interface declaration.
The Flex3 Language Reference says:
> Unlike ActionScript 2.0, ActionScript 3.0 allows the use of getter and
> setter methods in interface definitions.
So, it'd be supercool if normal var declarations in a mixin will be
transformed into getter/setter declarations in the AS3-interface.
Currently this will trigger an error in the flex compiler, because
"nodeType" is unknown for the LzDataNodeMixin interface:
---
var node:LzDataNodeMixin = ...
Debug.write(node.nodeType);
---
If we had getters/setters, this wouldn't be a problem. Or did I miss
something?
As an example:
This Laszlo-Mixin declaration:
---
mixin LzDataNodeMixin {
public var nodeType:int;
}
---
will be transformed to the following AS3 interface declaration:
---
interface LzDataNodeMixin {
public function get nodeType() :int;
public function set nodeType(nodeType:int) :void;
}
---
and an actual implementation would look like this:
---
class $lzsc$mixin$LzDataNodeMixin$LzMiniNode extends LzMiniNode
implements LzDataNodeMixin {
public var nodeType:int = 0;
/* auto generated getter/setter for nodeType */
public function get nodeType() :int {
return this.nodeType;
}
public function set nodeType(nodeType:int) :void {
this.nodeType = nodeType;
}
}
---
On 4/19/2008 3:34 PM, André Bargull wrote:
> Oh, I see. Thank you!
>
>
> On 4/19/2008 2:21 PM, Donald Anderson wrote:
>> Hi Andre.
>>
>> It was implemented for SWF9, and I have examples that work.
>> The functions appearing in the interface must be declared 'public',
>> and that is not the case here.
>>
>> - Don
>>
>> On Apr 19, 2008, at 7:02 AM, André Bargull wrote:
>>
>>> Mixins produce only an empty interface declaration for swf9? The
>>> description of LPP-5266 says:
>>>> 1) It should output an `interface`, that consists of the signature
>>>> of the mixin, i.e., all the method declarations. This will make it
>>>> so `instanceof` can work on mixins.
>>>
>>> So (1) wasn't implemented? For example LzDataElementMixin will be
>>> transformed to:
>>>> package {
>>>> interface LzDataElementMixin {
>>>> }
>>>> }
>>>
>>> But I've expected:
>>>> package {
>>>> interface LzDataElementMixin {
>>>> function insertBefore (newChild, refChild);
>>>> function replaceChild (newChild, oldChild);
>>>> function removeChild (oldChild);
>>>> [...]
>>>> }
>>>> }
>>>
>>
>>
>> --
>>
>> Don Anderson
>> Java/C/C++, Berkeley DB, systems consultant
>>
>> voice: 617-547-7881
>> email: dda at ddanderson.com
>> www: http://www.ddanderson.com
>>
>>
>>
>>
>>
>
More information about the Laszlo-dev
mailing list