flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <harbs.li...@gmail.com>
Subject Re: [FlexJS] Bindable and consts
Date Mon, 10 Jul 2017 16:22:26 GMT
Not urgent right now. Once I figured out what the problem was, I removed the Bindable tag.
It was not strictly necessary.

In my case the public static const was not exported. Not sure why.

I’m not sure that we always want to export these things either, but that’s a whole ‘nother
discussion that I keep putting off until we’re in a better place.

Harbs

> On Jul 10, 2017, at 6:54 PM, Alex Harui <aharui@adobe.com.INVALID> wrote:
> 
> How urgent is this?  I'm trying to figure out why the compiler did not
> respond properly to bad MXML.
> 
> I thought public APIs were all exported so they would survive getting
> renamed.  In the minified JS, the code will often access the renamed
> variable, but a tree of objects with properties also gets created.
> 
> -Alex
> 
> On 7/10/17, 2:12 AM, "Harbs" <harbs.lists@gmail.com> wrote:
> 
>> It appears that this is the case with any public static getter.
>> 
>> public static function get FOO():String{return “foo”}
>> or
>> public static function get FOO():Foo{return _foo}
>> 
>> I don’t see any reason why bracket notation would be needed. Is this a
>> throwback from before we had the get__ functions?
>> 
>> Thanks,
>> Harbs
>> 
>>> On Jul 9, 2017, at 11:27 PM, Harbs <harbs.lists@gmail.com> wrote:
>>> 
>>> I just discovered something:
>>> 
>>> Foo.as:
>>> package com.acme.foobaz.model{
>>> 	[Bindable]public class Foo{
>>> 		static public const BAZ:String = “baz”;
>>> 	}
>>> }
>>> 
>>> In some other class:
>>> 
>>> if(baz == Foo.BAZ){//do something}
>>> 
>>> compiles to:
>>> if(baz == com.acme.foobaz.model.Foo[“BAZ”])
>>> 
>>> If you remove the [Bindable] meta tag on the Foo class, it compiles to:
>>> if(baz == com.acme.foobaz.model.Foo.BAZ)
>>> 
>>> In the debug build, these two are functionally identical. However, when
>>> Google minifies the file, it has no way of knowing that Foo.BAZ is used.
>>> This results in calling  (assuming com.acme.foobaz.model.Foo becomes k)
>>> k.BAZ even though k.BAZ was optimized away and k.BAZ is undefined.
>>> 
>>> Why does [Bindable] on a class cause the bracket notation to be used?
>>> 
>>> Harbs
>> 
> 


Mime
View raw message