You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Justin Mclean <ju...@classsoftware.com> on 2017/02/15 23:31:56 UTC

[FlexJS] Text binding showing undefined

Hi,

This application when run displays “undefined” in text on the screen.

<?xml version="1.0" encoding="utf-8"?>
<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:js="library://ns.apache.org/flexjs/basic"
                xmlns:local="*">

    <js:valuesImpl>
        <js:SimpleCSSValuesImpl/>
    </js:valuesImpl>
    
    <js:initialView>
        <js:View percentWidth="100" percentHeight="100">
            <js:VContainer>
                <js:Label text="Here is some text" />
                <local:SimpleComponent />
            </js:VContainer>
        </js:View>
    </js:initialView>

</js:Application>

The component code:

<?xml version="1.0" encoding="utf-8"?>
<js:VContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:js="library://ns.apache.org/flexjs/basic">
    
    <fx:Script><![CDATA[        
                [Bindable] public var text:String;
        ]]></fx:Script>

    <js:beads>
        <js:ContainerDataBinding />
    </js:beads>

    <js:Label text="{text}" />

</js:VContainer>

This can be worked around by doing this in the component:

    <fx:Script><![CDATA[        
                [Bindable] public var text:String = “";
        ]]></fx:Script>

But still looks like a bug / is unexpected behaviour to me. What do other people think?

Thanks,
Justin

Re: [FlexJS] Text binding showing undefined

Posted by Alex Harui <ah...@adobe.com>.

On 2/16/17, 2:21 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:

>Hi,
>
>> It is totally fine, however, to have a TextModelWithEmptyStringDefaults.
>> And have Express use it and Harbs could use it in his app.  Again, what
>> percentage of the time in production will a label's text property not be
>> set to something other than “"?
>
>It would be a reasonably common with binding I think. (I ran into the
>issue reasonably quickly multiple times in this app I making). But there
>are work arounds so it's not a big issue.

Only if you haven't initialized your variables.

Flex definitely had checks for this, but IMO all these extra helpful bits
of code added up to something.

>
>Basically between creating a component and setting the value, if the
>values that is need to be set to comes from a HTTP call then the time
>between those two events could be noticeable by the user.

IMO, the framework doesn't know if you want to show the user a label that
is being filled via an HTTP call with "" or "Waiting for data..." or
something else, so it is presumptive to use up the code to assign "".

>
>I think it would be good idea to document all of these work arounds /
>fixes for common problems that Flex SDK or JS developers may run into.

Yep, we just need volunteers to help out.  We are also trying to remember
these things to add them to the Express components.  The goal is that
users of Express shouldn't hit these issues because that is where we add
more compensation code like folks are used to in Flex.  The premise is
that FlexJS won't be competitive if it has the overhead of Flex in JS.
FlexJS concepts like Beads, PAYG, etc in place to let someone get down to
the low-level if they need to.  And when you go low-level, you can't
assume much compensation code.

-Alex


Re: [FlexJS] Text binding showing undefined

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> It is totally fine, however, to have a TextModelWithEmptyStringDefaults.
> And have Express use it and Harbs could use it in his app.  Again, what
> percentage of the time in production will a label's text property not be
> set to something other than “"?

It would be a reasonably common with binding I think. (I ran into the issue reasonably quickly multiple times in this app I making). But there are work arounds so it's not a big issue.

Basically between creating a component and setting the value, if the values that is need to be set to comes from a HTTP call then the time between those two events could be noticeable by the user.

I think it would be good idea to document all of these work arounds / fixes for common problems that Flex SDK or JS developers may run into.

Thanks,
Justin

Re: [FlexJS] Text binding showing undefined

Posted by Alex Harui <ah...@adobe.com>.

On 2/20/17, 1:13 AM, "Harbs" <ha...@gmail.com> wrote:
>
>Yes and no. There’s two issues: Runtime performance, and minified code
>size. In terms of runtime performance, initializing class values should
>not have a negative effect. They would (slightly) add to code size, but
>having to load two different models in your app would add even more.

I would encourage you to replace every model with the model that has some
initialized values so there isn't two different models in the app.  That's
why we pull in default models from CSS.  Hopefully no model is wired in.

And of course, the fastest and smallest solution is to just initialize the
few instances variable when you need it.

Thanks,
-Alex


Re: [FlexJS] Text binding showing undefined

Posted by Harbs <ha...@gmail.com>.
> 
> My understanding is that Google Closure Compiler, which does the
> optimization, relies on us using foo.prototype.bar with JSDoc.  For some
> reason they have not chosen to output structures.  If you are certain it
> is more efficient, you should see if has been suggested on their issues
> list.  I am hopeful we do not have to get into the JS optimization game.
> I hope we can rely on Google.

I tried unsuccessfully to find discussions on assigning the prototype directly in GCC. I don’t know that I’m right. It’s something that might be worth exploring at some later point.

>> 
>>> For just one occurrence, you probably won't notice, But after we
>>> initialize 100 or 1000 properties to "" you might notice.
>> 
>> No. I don’t buy this. You’d need tens of millions of initializations to
>> have a measurable effect. If there are that many class initializations,
>> it will still not be noticeable because there will be so many bigger
>> performance bottlenecks, that it would still not be noticeable. Again,
>> this is just class initialization, so there’s no cost for object
>> instantiations. The solution of adding additional model classes is worse
>> than the problem.
> 
> In another thread, you pointed out that MaterialIconType added 77K to the
> code.  Don't all of these assignments add up to the same thing?

Yes and no. There’s two issues: Runtime performance, and minified code size. In terms of runtime performance, initializing class values should not have a negative effect. They would (slightly) add to code size, but having to load two different models in your app would add even more. Static constants are particularly big in terms of how they are declared because the text values are not minimized at all. I’m not suggesting to willy-nilly add initialization to every variable, but if there’s a logical reason to initialize specific ones, I don’t see that as a problem.


>> 
>> Additionally, initializing variables might actually *help* performance in
>> javascript because it allows the runtime to infer the type.[1]
>> 
>> [1]https://wildlyinaccurate.com/javascript-performance-variable-initializa <https://wildlyinaccurate.com/javascript-performance-variable-initializa>
>> tion/ 
>> <https://wildlyinaccurate.com/javascript-performance-variable-initializati <https://wildlyinaccurate.com/javascript-performance-variable-initializati>
>> on/>
> 
> In this article it tests assigning a default value of null vs a default
> value of a type.  I am proposing not assigning any default value at all.
> Then on the first actual assignment, the runtime will infer the correct
> type.

Maybe. I thought the point was that initializing it when it’s specifically declared helps, but you are likely right.

Either way, here’s an interesting article on Javascript optimization which has some general tips:
https://github.com/petkaantonov/bluebird/wiki/Optimization-killers

Harbs

Re: [FlexJS] Text binding showing undefined

Posted by Alex Harui <ah...@adobe.com>.

On 2/16/17, 11:59 PM, "Harbs" <ha...@gmail.com> wrote:

>
>> On Feb 17, 2017, at 12:43 AM, Alex Harui <ah...@adobe.com> wrote:
>> 
>> 
>> 
>> On 2/16/17, 2:34 PM, "Harbs" <ha...@gmail.com> wrote:
>> 
>>>> Well, that's not PAYG (yes, I'm being picky).
>>> 
>>> I disagree. For string it certainly is PAYG. There’s no extra cost.
>>>(and
>>> considering the three bytes of ‘=“”’ in the source code is getting
>>>petty
>>> IMO)
>> 
>> Pretty sure that uninitialized variables do not have any presence in
>> minified JS.  So every variable where you do this is adding
>> 
>>  foo.bar = "";
>> 
>> to the app.
>
>That does not sound right. It seems to be a change in behavior.
>
>Either way, it should be foo.prototype.bar=“”.

AIUI, the minified code would be a.bar.  They assign a temp var to
MyClass.prototype.

>
>Additionally, I mentioned a while back, that the code which falcon
>produces is not optimized for minimization. Instead of
>foo.prototype.bar;foo.prototype.baz; etc. it should output foo.prototype
>= {bar:””,foo:10} unless it is subclassing something else and the
>prototype needs to be added to. in that case, the code should produce
>something like this:
>(function(){var p = foo.prototype;p.bar=“”;p.baz=10;}())
>
>This is not something super important. There’s probably functionality
>which should happen first, but these changes would make a much bigger
>difference in app size (and probably loading as well) than some
>initialized values.

My understanding is that Google Closure Compiler, which does the
optimization, relies on us using foo.prototype.bar with JSDoc.  For some
reason they have not chosen to output structures.  If you are certain it
is more efficient, you should see if has been suggested on their issues
list.  I am hopeful we do not have to get into the JS optimization game.
I hope we can rely on Google.

>
>>> Adding an extra TextModelWithEmptyStringDefaults is totally
>>>unnecessary.
>>> 
>>>> Again, what
>>>> percentage of the time in production will a label's text property not
>>>>be
>>>> set to something other than “"?
>>> 
>>> More than you’d think. We ran into this because we were using
>>> ImageAndTextButton without text. But it’s quite common to have
>>>components
>>> which get text or not at runtime.
>> 
>> Then use ImageButton.  Or swap in a different model with empty string
>> defaults for ImageAndTextButton.
>
>ImageButton is horribly broken at the moment. It uses input rather than
>button as the other “Button”s do. It’s not very style-able, and the image
>is shown double to boot. It need to be changed to a button element and
>fixed up.
>
>> For just one occurrence, you probably won't notice, But after we
>> initialize 100 or 1000 properties to "" you might notice.
>
>No. I don’t buy this. You’d need tens of millions of initializations to
>have a measurable effect. If there are that many class initializations,
>it will still not be noticeable because there will be so many bigger
>performance bottlenecks, that it would still not be noticeable. Again,
>this is just class initialization, so there’s no cost for object
>instantiations. The solution of adding additional model classes is worse
>than the problem.

In another thread, you pointed out that MaterialIconType added 77K to the
code.  Don't all of these assignments add up to the same thing?

>
>Additionally, initializing variables might actually *help* performance in
>javascript because it allows the runtime to infer the type.[1]
>
>[1]https://wildlyinaccurate.com/javascript-performance-variable-initializa
>tion/ 
><https://wildlyinaccurate.com/javascript-performance-variable-initializati
>on/>

In this article it tests assigning a default value of null vs a default
value of a type.  I am proposing not assigning any default value at all.
Then on the first actual assignment, the runtime will infer the correct
type.

Thanks,
-Alex


Re: [FlexJS] Text binding showing undefined

Posted by Harbs <ha...@gmail.com>.
> On Feb 17, 2017, at 12:43 AM, Alex Harui <ah...@adobe.com> wrote:
> 
> 
> 
> On 2/16/17, 2:34 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>>> Well, that's not PAYG (yes, I'm being picky).
>> 
>> I disagree. For string it certainly is PAYG. There’s no extra cost. (and
>> considering the three bytes of ‘=“”’ in the source code is getting petty
>> IMO)
> 
> Pretty sure that uninitialized variables do not have any presence in
> minified JS.  So every variable where you do this is adding
> 
>  foo.bar = "";
> 
> to the app.

That does not sound right. It seems to be a change in behavior.

Either way, it should be foo.prototype.bar=“”.

Additionally, I mentioned a while back, that the code which falcon produces is not optimized for minimization. Instead of foo.prototype.bar;foo.prototype.baz; etc. it should output foo.prototype = {bar:””,foo:10} unless it is subclassing something else and the prototype needs to be added to. in that case, the code should produce something like this:
(function(){var p = foo.prototype;p.bar=“”;p.baz=10;}())

This is not something super important. There’s probably functionality which should happen first, but these changes would make a much bigger difference in app size (and probably loading as well) than some initialized values.

>> Adding an extra TextModelWithEmptyStringDefaults is totally unnecessary.
>> 
>>> Again, what
>>> percentage of the time in production will a label's text property not be
>>> set to something other than “"?
>> 
>> More than you’d think. We ran into this because we were using
>> ImageAndTextButton without text. But it’s quite common to have components
>> which get text or not at runtime.
> 
> Then use ImageButton.  Or swap in a different model with empty string
> defaults for ImageAndTextButton.

ImageButton is horribly broken at the moment. It uses input rather than button as the other “Button”s do. It’s not very style-able, and the image is shown double to boot. It need to be changed to a button element and fixed up.

> For just one occurrence, you probably won't notice, But after we
> initialize 100 or 1000 properties to "" you might notice.

No. I don’t buy this. You’d need tens of millions of initializations to have a measurable effect. If there are that many class initializations, it will still not be noticeable because there will be so many bigger performance bottlenecks, that it would still not be noticeable. Again, this is just class initialization, so there’s no cost for object instantiations. The solution of adding additional model classes is worse than the problem.

Additionally, initializing variables might actually *help* performance in javascript because it allows the runtime to infer the type.[1]

[1]https://wildlyinaccurate.com/javascript-performance-variable-initialization/ <https://wildlyinaccurate.com/javascript-performance-variable-initialization/>

Harbs

> My 2 cents,
> -Alex
> 


Re: [FlexJS] Text binding showing undefined

Posted by Alex Harui <ah...@adobe.com>.

On 2/16/17, 2:34 PM, "Harbs" <ha...@gmail.com> wrote:

>> Well, that's not PAYG (yes, I'm being picky).
>
>I disagree. For string it certainly is PAYG. There’s no extra cost. (and
>considering the three bytes of ‘=“”’ in the source code is getting petty
>IMO)

Pretty sure that uninitialized variables do not have any presence in
minified JS.  So every variable where you do this is adding

  foo.bar = "";

to the app.

> Adding an extra TextModelWithEmptyStringDefaults is totally unnecessary.
>
>> Again, what
>> percentage of the time in production will a label's text property not be
>> set to something other than “"?
>
>More than you’d think. We ran into this because we were using
>ImageAndTextButton without text. But it’s quite common to have components
>which get text or not at runtime.

Then use ImageButton.  Or swap in a different model with empty string
defaults for ImageAndTextButton.

For just one occurrence, you probably won't notice, But after we
initialize 100 or 1000 properties to "" you might notice.

My 2 cents,
-Alex


Re: [FlexJS] Text binding showing undefined

Posted by Alex Harui <ah...@adobe.com>.

On 2/17/17, 3:22 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlosrovira@apache.org> wrote:

>2017-02-16 23:34 GMT+01:00 Harbs <ha...@gmail.com>:
>
>> > Well, that's not PAYG (yes, I'm being picky).
>>
>> I disagree. For string it certainly is PAYG. There’s no extra cost. (and
>> considering the three bytes of ‘=“”’ in the source code is getting petty
>> IMO) Adding an extra TextModelWithEmptyStringDefaults is totally
>> unnecessary.
>>
>>
>+1
>
>and right that Array or Object are other kind of problem but usually use
>to
>be defaulted to null and in that cases programmer needs to make a special
>code to handle. But Strings and Numbers....it's clear for me that should
>has a default when needed since is more cost to handle it in other way.
>It's like an exception on the rule of PAYG.
>

Lots of little bits of code add up to something.  If you want proof, go
look at the Flex UIComponent.  Please, let's stick with PAYG and make
just-in-case code optional.  It is simple enough to swap in a different
model with defaults.

Otherwise, please allow me to inject 1000 extra assignment statements in
each application.  I really don't think we want that.

My 2 cents,
-Alex


Re: [FlexJS] Text binding showing undefined

Posted by Carlos Rovira <ca...@apache.org>.
2017-02-16 23:34 GMT+01:00 Harbs <ha...@gmail.com>:

> > Well, that's not PAYG (yes, I'm being picky).
>
> I disagree. For string it certainly is PAYG. There’s no extra cost. (and
> considering the three bytes of ‘=“”’ in the source code is getting petty
> IMO) Adding an extra TextModelWithEmptyStringDefaults is totally
> unnecessary.
>
>
+1

and right that Array or Object are other kind of problem but usually use to
be defaulted to null and in that cases programmer needs to make a special
code to handle. But Strings and Numbers....it's clear for me that should
has a default when needed since is more cost to handle it in other way.
It's like an exception on the rule of PAYG.


-- 
Carlos Rovira
http://about.me/carlosrovira

Re: [FlexJS] Text binding showing undefined

Posted by Harbs <ha...@gmail.com>.
> Well, that's not PAYG (yes, I'm being picky).

I disagree. For string it certainly is PAYG. There’s no extra cost. (and considering the three bytes of ‘=“”’ in the source code is getting petty IMO) Adding an extra TextModelWithEmptyStringDefaults is totally unnecessary.

> Again, what
> percentage of the time in production will a label's text property not be
> set to something other than “"?

More than you’d think. We ran into this because we were using ImageAndTextButton without text. But it’s quite common to have components which get text or not at runtime.

> but wouldn't be ok for an Array or Object.  The instnatiation and
> assignment of non-scalar initial values happens on every instantiation.

That’s valid, and we should not instantiate these unnecessarily.

> On Feb 17, 2017, at 12:02 AM, Alex Harui <ah...@adobe.com> wrote:
> 
> 
> 
> On 2/16/17, 12:00 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> I recently went this course in TextModel. By default, the text property
>> was undefined which propagated to the view when it was never set. I
>> changed it to 'private var _text:String = “”;' to set the default to an
>> empty string.
> 
> Well, that's not PAYG (yes, I'm being picky).  It is probably ok for
> String, but wouldn't be ok for an Array or Object.  The instnatiation and
> assignment of non-scalar initial values happens on every instantiation.
> 
> It is totally fine, however, to have a TextModelWithEmptyStringDefaults.
> And have Express use it and Harbs could use it in his app.  Again, what
> percentage of the time in production will a label's text property not be
> set to something other than ""?
> 
> It is also totally fine to create a version of Basic with lots of error
> checking and other fault tolerance.  There is no one right answer.
> 
> IMO, in Justin's example, he is creating his own uninitialized variable
> and assigning it via binding.  So default values in a TextModel won't
> matter.
> 
> My 2 cents,
> -Alex
> 


Re: [FlexJS] Text binding showing undefined

Posted by Alex Harui <ah...@adobe.com>.

On 2/16/17, 12:00 PM, "Harbs" <ha...@gmail.com> wrote:

>I recently went this course in TextModel. By default, the text property
>was undefined which propagated to the view when it was never set. I
>changed it to 'private var _text:String = “”;' to set the default to an
>empty string.

Well, that's not PAYG (yes, I'm being picky).  It is probably ok for
String, but wouldn't be ok for an Array or Object.  The instnatiation and
assignment of non-scalar initial values happens on every instantiation.

It is totally fine, however, to have a TextModelWithEmptyStringDefaults.
And have Express use it and Harbs could use it in his app.  Again, what
percentage of the time in production will a label's text property not be
set to something other than ""?

It is also totally fine to create a version of Basic with lots of error
checking and other fault tolerance.  There is no one right answer.

IMO, in Justin's example, he is creating his own uninitialized variable
and assigning it via binding.  So default values in a TextModel won't
matter.

My 2 cents,
-Alex


Re: [FlexJS] Text binding showing undefined

Posted by Harbs <ha...@gmail.com>.
I recently went this course in TextModel. By default, the text property was undefined which propagated to the view when it was never set. I changed it to 'private var _text:String = “”;' to set the default to an empty string.

Harbs

> On Feb 16, 2017, at 8:58 PM, Carlos Rovira <ca...@codeoscopic.com> wrote:
> 
> Hi, I was thinking the same as Om. Only setting a default would to the trick
> 
> thanks
> 
> 2017-02-16 19:56 GMT+01:00 OmPrakash Muppirala <bi...@gmail.com>:
> 
>> On Thu, Feb 16, 2017 at 10:51 AM, Alex Harui <ah...@adobe.com> wrote:
>> 
>>> 
>>> 
>>> On 2/16/17, 10:37 AM, "carlos.rovira@gmail.com on behalf of Carlos
>> Rovira"
>>> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
>>> wrote:
>>> 
>>>> Hi Alex,
>>>> 
>>>> IMHO, this is not PAYG, no body wants "undefined" as a possible output.
>>>> In my way of thinking this could be very radical way and take PAYG to
>> the
>>>> latest extreme.
>>>> In that way almost all things are PAYG and should not be implemented in
>>>> basic set ;) ... what do you think?
>>> 
>>> You are welcome to build in a test for null and undefined in your
>>> component sets.  The way I think of it is: in production, how often is
>>> null or undefined going to be assigned to a label?  I would think it
>> would
>>> be very rare, if at all, but I could be wrong.  If you use Model/View,
>>> have the model and its validators prevent null/undefined from being a
>>> value that the view is bound to.
>>> 
>> 
>> I don't think a test for null or undefined is required.  That implies code
>> running needlessly.
>> I am guessing that having a sensible default would solve this problem.
>> That does not run code needlessly.
>> 
>> Thanks,
>> Om
>> 
>> 
>>> 
>>> My 2 cents,
>>> -Alex
>>> 
>>>> 
>>>> 2017-02-16 2:55 GMT+01:00 Alex Harui <ah...@adobe.com>:
>>>> 
>>>>> The Basic components don't test for unexpected inputs.  It isn't PAYG.
>>>>> We
>>>>> should try to remember to add some defensive code for common cases to
>>>>> Express.
>>>>> 
>>>>> -Alex
>>>>> 
>>>>> On 2/15/17, 3:31 PM, "Justin Mclean" <ju...@classsoftware.com>
>> wrote:
>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> This application when run displays “undefined” in text on the screen.
>>>>>> 
>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>> <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>>>>>>               xmlns:js="library://ns.apache.org/flexjs/basic"
>>>>>>               xmlns:local="*">
>>>>>> 
>>>>>>   <js:valuesImpl>
>>>>>>       <js:SimpleCSSValuesImpl/>
>>>>>>   </js:valuesImpl>
>>>>>> 
>>>>>>   <js:initialView>
>>>>>>       <js:View percentWidth="100" percentHeight="100">
>>>>>>           <js:VContainer>
>>>>>>               <js:Label text="Here is some text" />
>>>>>>               <local:SimpleComponent />
>>>>>>           </js:VContainer>
>>>>>>       </js:View>
>>>>>>   </js:initialView>
>>>>>> 
>>>>>> </js:Application>
>>>>>> 
>>>>>> The component code:
>>>>>> 
>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>> <js:VContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
>>>>>>               xmlns:js="library://ns.apache.org/flexjs/basic">
>>>>>> 
>>>>>>   <fx:Script><![CDATA[
>>>>>>               [Bindable] public var text:String;
>>>>>>       ]]></fx:Script>
>>>>>> 
>>>>>>   <js:beads>
>>>>>>       <js:ContainerDataBinding />
>>>>>>   </js:beads>
>>>>>> 
>>>>>>   <js:Label text="{text}" />
>>>>>> 
>>>>>> </js:VContainer>
>>>>>> 
>>>>>> This can be worked around by doing this in the component:
>>>>>> 
>>>>>>   <fx:Script><![CDATA[
>>>>>>               [Bindable] public var text:String = “";
>>>>>>       ]]></fx:Script>
>>>>>> 
>>>>>> But still looks like a bug / is unexpected behaviour to me. What do
>>>>> other
>>>>>> people think?
>>>>>> 
>>>>>> Thanks,
>>>>>> Justin
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> 
>>>> Carlos Rovira
>>>> Director General
>>>> M: +34 607 22 60 05
>>>> http://www.codeoscopic.com
>>>> http://www.avant2.es
>>>> 
>>>> Este mensaje se dirige exclusivamente a su destinatario y puede contener
>>>> información privilegiada o confidencial. Si ha recibido este mensaje por
>>>> error, le rogamos que nos lo comunique inmediatamente por esta misma
>> vía y
>>>> proceda a su destrucción.
>>>> 
>>>> De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>>>> comunicamos
>>>> que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
>>>> S.A. La finalidad de dicho tratamiento es facilitar la prestación del
>>>> servicio o información solicitados, teniendo usted derecho de acceso,
>>>> rectificación, cancelación y oposición de sus datos dirigiéndose a
>>>> nuestras
>>>> oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
>>>> necesaria.
>>> 
>>> 
>> 
> 
> 
> 
> -- 
> 
> Carlos Rovira
> Director General
> M: +34 607 22 60 05
> http://www.codeoscopic.com
> http://www.avant2.es
> 
> Este mensaje se dirige exclusivamente a su destinatario y puede contener
> información privilegiada o confidencial. Si ha recibido este mensaje por
> error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> proceda a su destrucción.
> 
> De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
> que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> servicio o información solicitados, teniendo usted derecho de acceso,
> rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
> oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> necesaria.


Re: [FlexJS] Text binding showing undefined

Posted by Carlos Rovira <ca...@codeoscopic.com>.
Hi, I was thinking the same as Om. Only setting a default would to the trick

thanks

2017-02-16 19:56 GMT+01:00 OmPrakash Muppirala <bi...@gmail.com>:

> On Thu, Feb 16, 2017 at 10:51 AM, Alex Harui <ah...@adobe.com> wrote:
>
> >
> >
> > On 2/16/17, 10:37 AM, "carlos.rovira@gmail.com on behalf of Carlos
> Rovira"
> > <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
> > wrote:
> >
> > >Hi Alex,
> > >
> > >IMHO, this is not PAYG, no body wants "undefined" as a possible output.
> > >In my way of thinking this could be very radical way and take PAYG to
> the
> > >latest extreme.
> > >In that way almost all things are PAYG and should not be implemented in
> > >basic set ;) ... what do you think?
> >
> > You are welcome to build in a test for null and undefined in your
> > component sets.  The way I think of it is: in production, how often is
> > null or undefined going to be assigned to a label?  I would think it
> would
> > be very rare, if at all, but I could be wrong.  If you use Model/View,
> > have the model and its validators prevent null/undefined from being a
> > value that the view is bound to.
> >
>
> I don't think a test for null or undefined is required.  That implies code
> running needlessly.
> I am guessing that having a sensible default would solve this problem.
> That does not run code needlessly.
>
> Thanks,
> Om
>
>
> >
> > My 2 cents,
> > -Alex
> >
> > >
> > >2017-02-16 2:55 GMT+01:00 Alex Harui <ah...@adobe.com>:
> > >
> > >> The Basic components don't test for unexpected inputs.  It isn't PAYG.
> > >>We
> > >> should try to remember to add some defensive code for common cases to
> > >> Express.
> > >>
> > >> -Alex
> > >>
> > >> On 2/15/17, 3:31 PM, "Justin Mclean" <ju...@classsoftware.com>
> wrote:
> > >>
> > >> >Hi,
> > >> >
> > >> >This application when run displays “undefined” in text on the screen.
> > >> >
> > >> ><?xml version="1.0" encoding="utf-8"?>
> > >> ><js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> > >> >                xmlns:js="library://ns.apache.org/flexjs/basic"
> > >> >                xmlns:local="*">
> > >> >
> > >> >    <js:valuesImpl>
> > >> >        <js:SimpleCSSValuesImpl/>
> > >> >    </js:valuesImpl>
> > >> >
> > >> >    <js:initialView>
> > >> >        <js:View percentWidth="100" percentHeight="100">
> > >> >            <js:VContainer>
> > >> >                <js:Label text="Here is some text" />
> > >> >                <local:SimpleComponent />
> > >> >            </js:VContainer>
> > >> >        </js:View>
> > >> >    </js:initialView>
> > >> >
> > >> ></js:Application>
> > >> >
> > >> >The component code:
> > >> >
> > >> ><?xml version="1.0" encoding="utf-8"?>
> > >> ><js:VContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
> > >> >                xmlns:js="library://ns.apache.org/flexjs/basic">
> > >> >
> > >> >    <fx:Script><![CDATA[
> > >> >                [Bindable] public var text:String;
> > >> >        ]]></fx:Script>
> > >> >
> > >> >    <js:beads>
> > >> >        <js:ContainerDataBinding />
> > >> >    </js:beads>
> > >> >
> > >> >    <js:Label text="{text}" />
> > >> >
> > >> ></js:VContainer>
> > >> >
> > >> >This can be worked around by doing this in the component:
> > >> >
> > >> >    <fx:Script><![CDATA[
> > >> >                [Bindable] public var text:String = “";
> > >> >        ]]></fx:Script>
> > >> >
> > >> >But still looks like a bug / is unexpected behaviour to me. What do
> > >>other
> > >> >people think?
> > >> >
> > >> >Thanks,
> > >> >Justin
> > >>
> > >>
> > >
> > >
> > >--
> > >
> > >Carlos Rovira
> > >Director General
> > >M: +34 607 22 60 05
> > >http://www.codeoscopic.com
> > >http://www.avant2.es
> > >
> > >Este mensaje se dirige exclusivamente a su destinatario y puede contener
> > >información privilegiada o confidencial. Si ha recibido este mensaje por
> > >error, le rogamos que nos lo comunique inmediatamente por esta misma
> vía y
> > >proceda a su destrucción.
> > >
> > >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
> > >comunicamos
> > >que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> > >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> > >servicio o información solicitados, teniendo usted derecho de acceso,
> > >rectificación, cancelación y oposición de sus datos dirigiéndose a
> > >nuestras
> > >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> > >necesaria.
> >
> >
>



-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

Re: [FlexJS] Text binding showing undefined

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Thu, Feb 16, 2017 at 10:51 AM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 2/16/17, 10:37 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
> wrote:
>
> >Hi Alex,
> >
> >IMHO, this is not PAYG, no body wants "undefined" as a possible output.
> >In my way of thinking this could be very radical way and take PAYG to the
> >latest extreme.
> >In that way almost all things are PAYG and should not be implemented in
> >basic set ;) ... what do you think?
>
> You are welcome to build in a test for null and undefined in your
> component sets.  The way I think of it is: in production, how often is
> null or undefined going to be assigned to a label?  I would think it would
> be very rare, if at all, but I could be wrong.  If you use Model/View,
> have the model and its validators prevent null/undefined from being a
> value that the view is bound to.
>

I don't think a test for null or undefined is required.  That implies code
running needlessly.
I am guessing that having a sensible default would solve this problem.
That does not run code needlessly.

Thanks,
Om


>
> My 2 cents,
> -Alex
>
> >
> >2017-02-16 2:55 GMT+01:00 Alex Harui <ah...@adobe.com>:
> >
> >> The Basic components don't test for unexpected inputs.  It isn't PAYG.
> >>We
> >> should try to remember to add some defensive code for common cases to
> >> Express.
> >>
> >> -Alex
> >>
> >> On 2/15/17, 3:31 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:
> >>
> >> >Hi,
> >> >
> >> >This application when run displays “undefined” in text on the screen.
> >> >
> >> ><?xml version="1.0" encoding="utf-8"?>
> >> ><js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> >> >                xmlns:js="library://ns.apache.org/flexjs/basic"
> >> >                xmlns:local="*">
> >> >
> >> >    <js:valuesImpl>
> >> >        <js:SimpleCSSValuesImpl/>
> >> >    </js:valuesImpl>
> >> >
> >> >    <js:initialView>
> >> >        <js:View percentWidth="100" percentHeight="100">
> >> >            <js:VContainer>
> >> >                <js:Label text="Here is some text" />
> >> >                <local:SimpleComponent />
> >> >            </js:VContainer>
> >> >        </js:View>
> >> >    </js:initialView>
> >> >
> >> ></js:Application>
> >> >
> >> >The component code:
> >> >
> >> ><?xml version="1.0" encoding="utf-8"?>
> >> ><js:VContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
> >> >                xmlns:js="library://ns.apache.org/flexjs/basic">
> >> >
> >> >    <fx:Script><![CDATA[
> >> >                [Bindable] public var text:String;
> >> >        ]]></fx:Script>
> >> >
> >> >    <js:beads>
> >> >        <js:ContainerDataBinding />
> >> >    </js:beads>
> >> >
> >> >    <js:Label text="{text}" />
> >> >
> >> ></js:VContainer>
> >> >
> >> >This can be worked around by doing this in the component:
> >> >
> >> >    <fx:Script><![CDATA[
> >> >                [Bindable] public var text:String = “";
> >> >        ]]></fx:Script>
> >> >
> >> >But still looks like a bug / is unexpected behaviour to me. What do
> >>other
> >> >people think?
> >> >
> >> >Thanks,
> >> >Justin
> >>
> >>
> >
> >
> >--
> >
> >Carlos Rovira
> >Director General
> >M: +34 607 22 60 05
> >http://www.codeoscopic.com
> >http://www.avant2.es
> >
> >Este mensaje se dirige exclusivamente a su destinatario y puede contener
> >información privilegiada o confidencial. Si ha recibido este mensaje por
> >error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> >proceda a su destrucción.
> >
> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
> >comunicamos
> >que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> >servicio o información solicitados, teniendo usted derecho de acceso,
> >rectificación, cancelación y oposición de sus datos dirigiéndose a
> >nuestras
> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> >necesaria.
>
>

Re: [FlexJS] Text binding showing undefined

Posted by Alex Harui <ah...@adobe.com>.

On 2/16/17, 10:37 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com> wrote:

>Hi Alex,
>
>IMHO, this is not PAYG, no body wants "undefined" as a possible output.
>In my way of thinking this could be very radical way and take PAYG to the
>latest extreme.
>In that way almost all things are PAYG and should not be implemented in
>basic set ;) ... what do you think?

You are welcome to build in a test for null and undefined in your
component sets.  The way I think of it is: in production, how often is
null or undefined going to be assigned to a label?  I would think it would
be very rare, if at all, but I could be wrong.  If you use Model/View,
have the model and its validators prevent null/undefined from being a
value that the view is bound to.

My 2 cents,
-Alex

>
>2017-02-16 2:55 GMT+01:00 Alex Harui <ah...@adobe.com>:
>
>> The Basic components don't test for unexpected inputs.  It isn't PAYG.
>>We
>> should try to remember to add some defensive code for common cases to
>> Express.
>>
>> -Alex
>>
>> On 2/15/17, 3:31 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:
>>
>> >Hi,
>> >
>> >This application when run displays “undefined” in text on the screen.
>> >
>> ><?xml version="1.0" encoding="utf-8"?>
>> ><js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>> >                xmlns:js="library://ns.apache.org/flexjs/basic"
>> >                xmlns:local="*">
>> >
>> >    <js:valuesImpl>
>> >        <js:SimpleCSSValuesImpl/>
>> >    </js:valuesImpl>
>> >
>> >    <js:initialView>
>> >        <js:View percentWidth="100" percentHeight="100">
>> >            <js:VContainer>
>> >                <js:Label text="Here is some text" />
>> >                <local:SimpleComponent />
>> >            </js:VContainer>
>> >        </js:View>
>> >    </js:initialView>
>> >
>> ></js:Application>
>> >
>> >The component code:
>> >
>> ><?xml version="1.0" encoding="utf-8"?>
>> ><js:VContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
>> >                xmlns:js="library://ns.apache.org/flexjs/basic">
>> >
>> >    <fx:Script><![CDATA[
>> >                [Bindable] public var text:String;
>> >        ]]></fx:Script>
>> >
>> >    <js:beads>
>> >        <js:ContainerDataBinding />
>> >    </js:beads>
>> >
>> >    <js:Label text="{text}" />
>> >
>> ></js:VContainer>
>> >
>> >This can be worked around by doing this in the component:
>> >
>> >    <fx:Script><![CDATA[
>> >                [Bindable] public var text:String = “";
>> >        ]]></fx:Script>
>> >
>> >But still looks like a bug / is unexpected behaviour to me. What do
>>other
>> >people think?
>> >
>> >Thanks,
>> >Justin
>>
>>
>
>
>-- 
>
>Carlos Rovira
>Director General
>M: +34 607 22 60 05
>http://www.codeoscopic.com
>http://www.avant2.es
>
>Este mensaje se dirige exclusivamente a su destinatario y puede contener
>información privilegiada o confidencial. Si ha recibido este mensaje por
>error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
>proceda a su destrucción.
>
>De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>comunicamos
>que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
>S.A. La finalidad de dicho tratamiento es facilitar la prestación del
>servicio o información solicitados, teniendo usted derecho de acceso,
>rectificación, cancelación y oposición de sus datos dirigiéndose a
>nuestras
>oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
>necesaria.


Re: [FlexJS] Text binding showing undefined

Posted by Carlos Rovira <ca...@codeoscopic.com>.
Hi Alex,

IMHO, this is not PAYG, no body wants "undefined" as a possible output.
In my way of thinking this could be very radical way and take PAYG to the
latest extreme.
In that way almost all things are PAYG and should not be implemented in
basic set ;) ... what do you think?

2017-02-16 2:55 GMT+01:00 Alex Harui <ah...@adobe.com>:

> The Basic components don't test for unexpected inputs.  It isn't PAYG.  We
> should try to remember to add some defensive code for common cases to
> Express.
>
> -Alex
>
> On 2/15/17, 3:31 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:
>
> >Hi,
> >
> >This application when run displays “undefined” in text on the screen.
> >
> ><?xml version="1.0" encoding="utf-8"?>
> ><js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> >                xmlns:js="library://ns.apache.org/flexjs/basic"
> >                xmlns:local="*">
> >
> >    <js:valuesImpl>
> >        <js:SimpleCSSValuesImpl/>
> >    </js:valuesImpl>
> >
> >    <js:initialView>
> >        <js:View percentWidth="100" percentHeight="100">
> >            <js:VContainer>
> >                <js:Label text="Here is some text" />
> >                <local:SimpleComponent />
> >            </js:VContainer>
> >        </js:View>
> >    </js:initialView>
> >
> ></js:Application>
> >
> >The component code:
> >
> ><?xml version="1.0" encoding="utf-8"?>
> ><js:VContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
> >                xmlns:js="library://ns.apache.org/flexjs/basic">
> >
> >    <fx:Script><![CDATA[
> >                [Bindable] public var text:String;
> >        ]]></fx:Script>
> >
> >    <js:beads>
> >        <js:ContainerDataBinding />
> >    </js:beads>
> >
> >    <js:Label text="{text}" />
> >
> ></js:VContainer>
> >
> >This can be worked around by doing this in the component:
> >
> >    <fx:Script><![CDATA[
> >                [Bindable] public var text:String = “";
> >        ]]></fx:Script>
> >
> >But still looks like a bug / is unexpected behaviour to me. What do other
> >people think?
> >
> >Thanks,
> >Justin
>
>


-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

Re: [FlexJS] Text binding showing undefined

Posted by Alex Harui <ah...@adobe.com>.
The Basic components don't test for unexpected inputs.  It isn't PAYG.  We
should try to remember to add some defensive code for common cases to
Express.

-Alex

On 2/15/17, 3:31 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:

>Hi,
>
>This application when run displays “undefined” in text on the screen.
>
><?xml version="1.0" encoding="utf-8"?>
><js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>                xmlns:js="library://ns.apache.org/flexjs/basic"
>                xmlns:local="*">
>
>    <js:valuesImpl>
>        <js:SimpleCSSValuesImpl/>
>    </js:valuesImpl>
>    
>    <js:initialView>
>        <js:View percentWidth="100" percentHeight="100">
>            <js:VContainer>
>                <js:Label text="Here is some text" />
>                <local:SimpleComponent />
>            </js:VContainer>
>        </js:View>
>    </js:initialView>
>
></js:Application>
>
>The component code:
>
><?xml version="1.0" encoding="utf-8"?>
><js:VContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
>                xmlns:js="library://ns.apache.org/flexjs/basic">
>    
>    <fx:Script><![CDATA[
>                [Bindable] public var text:String;
>        ]]></fx:Script>
>
>    <js:beads>
>        <js:ContainerDataBinding />
>    </js:beads>
>
>    <js:Label text="{text}" />
>
></js:VContainer>
>
>This can be worked around by doing this in the component:
>
>    <fx:Script><![CDATA[
>                [Bindable] public var text:String = “";
>        ]]></fx:Script>
>
>But still looks like a bug / is unexpected behaviour to me. What do other
>people think?
>
>Thanks,
>Justin