The problem with this subclassing approach is that, doing this the right
way, I would have to cut-and-paste the "__createRequest" and a number of
other private functions wholesale into the subclass. All I really wanted to
do was swap the order of two lines in the "invoke" method.
I agree that mixins shouldn't have access to private members when
"include"ed but when "patch"ing, which is a hacky last-resort anyway, I
should have complete access.
-deech
On Thu, Jan 12, 2012 at 11:33 AM, Derrell Lipman <
[email protected]> wrote:
>
>
> On Thu, Jan 12, 2012 at 12:28, aditya siram <[email protected]>wrote:
>
>> Hi all,
>> I had a mixin issue that I'd been battling for the past couple of days
>> and fixed it but wanted to post the solution.
>>
>> The problem was that I needed to patch the "qx.io.rest.Resource" class
>> and with a new "invoke(...)" method. In my "source" application everything
>> worked fine and the mixin's method was used with no problem. In the "build"
>> version I kept getting an error saying that my mixin was undefined.
>>
>> The original "invoke" method looks something like:
>> invoke : function ( ... ) {
>> ...
>> this.__createRequest();
>> ...
>> }
>>
>> And my mixin method looked like:
>> invoke : function ( ... ) {
>> ...
>> this.__createRequest();
>> doSomeMoreStuff();
>> ...
>> }
>>
>>
>> The reason this is happening is that the "__createRequest" method in
>> "qx.io.rest.Resource" gets mangled before the mixin patches the class and
>> so the "this.__createRequest()" call in the mixin is "undefined".
>>
>> The stop-gap solution is to turn off private method name-mangling in my
>> config.json like so :
>> "let" :{
>> ...
>> /* disable "privates" optimization in build version due to current
>> issues */
>> "OPTIMIZE" : ["variables", "basecalls", "strings"],
>> ...
>> }
>>
>> I think this is a bug in the "build" job because I would expect the
>> mixin to patch the class before name-mangling.
>>
>
> No, you just can't do that. Mixins have no more right to access private
> members than does anything else.
>
> In this case, though, could you not simply subclass qx.io.rest.Resource,
> override the invoke() method such that it calls the superclass method
> followed by doing your own stuff? You could then use your subclass instead
> of qx.io.rest.Resource.
>
> Derrell
>
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Mar 27 - Feb 2
> Save $400 by Jan. 27
> Register now!
> http://p.sf.net/sfu/rsa-sfdev2dev2
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel