Prev: How to link CSS(s) already linked to parent frame into child iframe using javascript
Next: Error getElementbyClassName
From: David Mark on 13 Jan 2010 07:08 Thomas 'PointedEars' Lahn wrote: > Jorge wrote: > >> Thomas 'PointedEars' Lahn wrote: >>> Jorge wrote: >>>> Thomas 'PointedEars' Lahn wrote: >>>>> IBTD. A user-defined `constructor' property of the prototype of an >>>>> object can be most useful. One basic principle of OOP is >>>>> polymorphism, and one method of achieving that is overloading; that >>>>> is, a method is defined on an object that is also defined on a >>>>> superordinate object (in class-based OOP: the superclass; in >>>>> prototype-based OOP: the next object in the prototype chain). (...) >>>> The need to access a superclass in order to achieve polymorphism is >>>> ~non-inexistent, for in a weakly typed language such as JS a single >>>> method is usually enough -> there's no need to overload anything, nor >>>> access a superclass. >>> A need that you are unable to perceive is still a need. I am using this >>> pattern to my advantage, with the exception... >> ...that it has nothing to do with polymorphism. > > Yes, it has. "In computer science, polymorphism is a programming language > feature that allows values of different data types to be handled using a > uniform interface. [...]" (en.Wikipedia) > > If a method is named the same for an object as for a superordinate object, > so that the object's method performs only the tasks specific to the object, > calling the superordinate's object to perform the more general tasks > specific to object's derived from that superordinate object/class before, > then that is one rather important application of polymorphism as it allows > for API consistency and code re-use. > > You don't know what you are talking about, or you are unable to read and > understand English. Probably both. Yes. +2. :)
From: Jorge on 13 Jan 2010 07:18 On Jan 13, 1:05 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> wrote: > (...) > o.foo = function() { > /* > * Pray call C.prototype.foo() here without referring > * to the constructor or the prototype object > */ //Pay close attention, Pointy: var save= this.foo; delete this.foo(); this.foo(); this.foo= save; > (...) -- Jorge.
From: Jorge on 13 Jan 2010 07:20 On Jan 13, 1:18 pm, Jorge <jo...(a)jorgechamorro.com> wrote: > On Jan 13, 1:05 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> > wrote: > > > (...) > > o.foo = function() { > > /* > > * Pray call C.prototype.foo() here without referring > > * to the constructor or the prototype object > > */ > > //Pay close attention, Pointy: > > var save= this.foo; > delete this.foo(); > this.foo(); > this.foo= save; > > > (...) > > -- > Jorge. s/delete this.foo()/delete this.foo; -- Jorge.
From: David Mark on 13 Jan 2010 07:22 Jorge wrote: > On Jan 13, 1:05 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> > wrote: >> (...) >> o.foo = function() { >> /* >> * Pray call C.prototype.foo() here without referring >> * to the constructor or the prototype object >> */ > > //Pay close attention, Pointy: > > var save= this.foo; > delete this.foo(); > this.foo(); > this.foo= save; > What did I tell you Jorge? :(
From: David Mark on 13 Jan 2010 07:22
Jorge wrote: > On Jan 13, 1:18 pm, Jorge <jo...(a)jorgechamorro.com> wrote: >> On Jan 13, 1:05 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> >> wrote: >> >>> (...) >>> o.foo = function() { >>> /* >>> * Pray call C.prototype.foo() here without referring >>> * to the constructor or the prototype object >>> */ >> //Pay close attention, Pointy: >> >> var save= this.foo; >> delete this.foo(); >> this.foo(); >> this.foo= save; >> >>> (...) >> -- >> Jorge. > > s/delete this.foo()/delete this.foo; Delete the whole damned thing. Please. |