It's there since 0.7 I think. You can turn the optimization off, it would
work BUT it's an OO feature and you can avoid future headache using it
correctly.
In your example you could easily solve that, putting getRestricted in your
parent class or removing one underscore of your member _restricted.
If "variableaccess.Parent" is a qooxdoo class, it is NOT guaranteed that
__restricted will be there in the next release. And you can lose some
precious time looking for errors after updating to the new version.
It's more future proof to just use it property.
On Tue, Oct 26, 2010 at 5:38 PM, aditya siram <[email protected]>wrote:
> I didn't know that was enforced. Is this new with version 1.2? Can I turn
> it off somehow?
> -deech
>
>
> On Tue, Oct 26, 2010 at 1:55 PM, Guilherme Aiolfi <[email protected]>wrote:
>
>> Hi,
>>
>> Members with two underlines before it like yours: __restricted are
>> considered "private" and are not visible in the child class. If you want it
>> to be visible in your child class and no visible outside the class it needs
>> to be "protected". To do that, use just one underline before your variable
>> name, like: members: { _restricted: null }.
>>
>> It works in the source version because it wasn't optimized and obfuscated
>> yet. The generator does that in the build job.
>>
>> On Tue, Oct 26, 2010 at 4:31 PM, aditya siram <[email protected]>wrote:
>>
>>> Hi all,
>>> There seems to be some difference with getting and setting inherited
>>> variables between the build and source version of my app. In the build
>>> version when a child class accesses a variable in the parent class it is
>>> "undefined", whereas in the "source" version it correctly gets the value
>>> from the super class.
>>>
>>> For example suppose we have a parent class with one variable:
>>> qx.Class.define("variableaccess.Parent",
>>> {
>>> extend : qx.core.Object,
>>> members : {
>>> __restricted : null,
>>> setRestricted : function (a) {
>>> this.__restricted = a;
>>> }
>>> }
>>> });
>>>
>>> and a child class that extends it:
>>> qx.Class.define("variableaccess.Child",
>>> {
>>> extend : variableaccess.Parent,
>>> members : {
>>> getRestricted : function () {
>>> return this.__restricted;
>>> }
>>> }
>>> });
>>>
>>> and a main class :
>>> /*
>>> ************************************************************************
>>>
>>> #asset(variableaccess/*)
>>>
>>> ************************************************************************
>>> */
>>>
>>> qx.Class.define("variableaccess.Application",
>>> {
>>> extend : qx.application.Standalone,
>>> members :
>>> {
>>> main : function()
>>> {
>>> this.base(arguments);
>>> var child = new variableaccess.Child();
>>> child.setRestricted(1);
>>> console.log(child.getRestricted());
>>> }
>>> }
>>> });
>>>
>>> Running it as "source", the console correctly outputs 1, where in "build"
>>> I get an "undefined".
>>>
>>> Thanks!
>>> -deech
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Nokia and AT&T present the 2010 Calling All Innovators-North America
>>> contest
>>> Create new apps & games for the Nokia N8 for consumers in U.S. and
>>> Canada
>>> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
>>> marketing
>>> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
>>> http://p.sf.net/sfu/nokia-dev2dev
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Nokia and AT&T present the 2010 Calling All Innovators-North America
>> contest
>> Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
>> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
>> marketing
>> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
>> http://p.sf.net/sfu/nokia-dev2dev
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America
> contest
> Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
> marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel