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

Reply via email to