[Laszlo-dev] fix for LPP-4289 "LzDataElementTrait#valueToElement(..)" must be a static-method
P T Withington
ptw at openlaszlo.org
Fri Jul 20 10:00:35 PDT 2007
I think this is annoying but correct.
The proposed (ECMAScript 4 Spec](http://developer.mozilla.org/es4/
spec/chapter_9_classes.html) says:
> Unlike in some other object oriented languages (e.g. Java), static
> properties of the base class are not inherited, but they are in
> scope in the static and instance methods of the derived class.
>
I don't know the rationale for that decision. I think they adopted
it from [AS3](http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/
common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000068.html).
On 2007-07-20, at 12:10 EDT, Henry Minsky wrote:
> There's a bug filed (LPP-4289) about how
> lzDataElement.valueToElementdoesn't work in legals,
> because it needs to be a static method.
>
> The method is actually defined in the mixin lzDataElementTrait, and
> if I
> declare it static, it doesn't magically
> appear visible as LzDataElement.valueToElement. My solution so far
> looks
> like this, which declares it again
> in LzDataElement. Is there a better way to do this?
>
>
>
> trait LzDataElementTrait {
>
> static function valueToElement ( o ) {
> var n = new LzDataElement("element", { },
> LzDataElementTrait.__LZv2E(o));
> return n;
> }
>
> static function __LZv2E ( o ) { ... }
>
> }
>
>
> class LzDataElement extends LzMiniNode inherits LzDataElementTrait,
> LzDataNode {
> ...
> ...
> static var valueToElement = LzDataElementTrait.valueToElement;
> }
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
More information about the Laszlo-dev
mailing list