[PD-dev] "object" lib

Mathieu Bouchard matju at artengine.ca
Thu Apr 13 08:17:54 CEST 2006


On Sun, 9 Apr 2006, Chris McCormick wrote:
> On Fri, Apr 07, 2006 at 01:47:51PM -0400, Mathieu Bouchard wrote:
> > The "copy-and-modify" part of those languages isn't inheritance, it's
> > construction: they don't have ordinary "constructors". They both support
> > inheritance but they both don't use classes to do inheritance.
> I don't beleive this is true of Javascript. The only way to "inherit"
> in javascript is to copy an existing object and then add methods to it
> from the object you want to inherit from.

No, you have to set a property called "prototype", to which property 
lookup of missing properties will be delegated. I don't know whether 
Javascript supports multiple prototypes, but the SELF language does.
(SELF was a major inspiration for JavaScript)

> > No it's not: those languages have the "class" role played by ordinary
> > objects: if you modify an object that is a "class" for other objects,
> > those other objects immediately start behaving differently. That's even 
> I don't beleive this is true for Javascript either. Once you copy an
> object you get a totally new object - if you modify the original object
> you copied from, it will not affect the newly copied object, and if you
> modify the new object it will not affect the original object.

Once you copy an object you get a totally new object, but the "prototype"  
property is shared; i mean, it's a separate variable, but it points to the
same object as the original "prototype" variable until you reassign it.

Here's a JavaScript tutorial that may help you understanding how
prototypes work: http://www.codeproject.com/aspnet/JsOOP1.asp

> If you ask me, this is more like having a fixed method of an object and
> giving it an argument that re-configures the way it works than modifying
> the code. But not entirely. This highlights the problem with trying to
> map concepts like "method" and "object" onto Pd.

I was talking about modifying the objects inside the abstraction. If you 
consider whatever you do in Edit Mode to be just "re-configuration", then 
you may as well call all code as "data" and coding as "re-configuring the 
compiler".

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada




More information about the Pd-dev mailing list