Dietrich Streifert schrieb:
>
>
> Sebastian Werner schrieb:
>> Dietrich Streifert schrieb:
>>
>>> Fabian Jakobs schrieb:
>>>
>>>> Dietrich Streifert schrieb:
>>>>
>>>>
>>>>> Thank you Jim.
>>>>>
>>>>> That sounds promising. I also used to extend qx.ui.core.Widget with my
>>>>> own set of properties by using the qx.Proto = ..classname.. syntax.
>>>>>
>>>>> One more question left ;-)
>>>>>
>>>>> Is it possible to "overwrite" or redeclare a method of a class by
>>>>> using mixins? If yes: do I have access to the original method of the
>>>>> class?
>>>>> Something like:
>>>>>
>>>>> theMethod: function(arg) {
>>>>> doSomethingWithArg(arg);
>>>>> hookToOldMethod.theMethod(arg);
>>>>> }
>>>>>
>>>>>
>>>>> The typical usage would be to add some code to the method and then
>>>>> call the original method.
>>>>>
>>>>>
>>>> Now it's getting dirty ;-) You can overwrite existing methods but there
>>>> is no way to access the original implementation once it is overwritten.
>>>> We have no supported way to do this using mixins. You can however always
>>>> hack the prototype of an existing class and achieve this.
>>>>
>>>>
>>>>
>>> Why is this dirty? There is no real protection in javascript (as it
>>> exists in eg. java) against replacing attributes, methods or classes. If
>>> the language allows this, the developers will do it.
>>>
>>
>> It's not dirty regarding the implementation. It's dirty regarding other
>> things. Maybe stability etc.
>>
>> Overwrite an existing function - even to extend them - means that you
>> change the behavior to something which was not planned by the original
>> author and this could break code which relies on exactly the old behavior.
>>
>> Generally one could say that using "patch" removes the responsibility
>> from the original author and moves it to the modifier. I think in the
>> most cases it should be possible to live without patching existing
>> function. I really think that everyboding using patch should separate
>> the stuff which don't need "patch" and use "include" for these.
>>
>>
>>> So having an interface for doing this "dirty things" in a consistent and
>>> documented way, will lead to code which is more readable by others and
>>> is parseable by the qooxdoo generator which will allow migration pathes.
>>>
>>
>> This is the reason why qooxdoo 0.7 will have such an interface :)
>>
>>
>
> Thank you for the patch mixin implementation.
>
> Anyhow one thing is missing in the patch implementation (as Fabian
> said): The possibility to get access to the original method. So when a
> mixin re-implements a method, the old method should still be accessible
> from within the new method implementation. If a mixin patches the method
> doFoo we should be able to write:
>
> function doFoo(bar) {
> return this.__patch__orignalDoFoo.call(this,bar);
> }
>
> where this.__patch__originalDoFoo contains the original method.
>
> Is this possible? Do you plan to implement this functionality?
Nothing to implement here I think. You can easily access the prototype
method of the original:
return qx.original.class.prototype.doFoo.call(this, bar);
>
> BTW: The new OO interface is GREAT.
Thanks. We like it too ;)
Sebastian
>
>> Sebastian
>>
>>
>>>> Best Fabian
>>>>
>>>> -------------------------------------------------------------------------
>>>> Take Surveys. Earn Cash. Influence the Future of IT
>>>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>>>> your
>>>> opinions on IT & business topics through brief surveys-and earn cash
>>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>>> _______________________________________________
>>>> qooxdoo-devel mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>>
>>>>
>>> --
>>> Mit freundlichen Grüßen
>>> Dietrich Streifert
>>> --
>>> Visionet GmbH
>>> Firmensitz: Am Weichselgarten 7, 91058 Erlangen
>>> Registergericht: Handelsregister Fürth, HRB 6573
>>> Geschäftsführer: Stefan Lindner
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> -------------------------------------------------------------------------
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>>> opinions on IT & business topics through brief surveys-and earn cash
>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>
> --
> Mit freundlichen Grüßen
> Dietrich Streifert
> --
> Visionet GmbH
> Firmensitz: Am Weichselgarten 7, 91058 Erlangen
> Registergericht: Handelsregister Fürth, HRB 6573
> Geschäftsführer: Stefan Lindner
>
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel