Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Dynamically Modifying objects!

From: edanaii:cox at: 22-Feb-2003 13:50

Joel Neely wrote:
>Hi, Ed, > >Ed Dana wrote: > >>... I merely stated that this was my solution to the "problem". >> >>For all intents and purposes, the object is dynamic. >>Maybe not in the truest sense of the word, but certainly enough >>to achieve my goals. >> >> >> > >Apparently I didn't understand understand your goals. Sorry. >
No big whoop, really. :)
>>This was never my intention. I didn't want attributes shared >>between parent and child dynamically... >> >>I wanted the ability to add and remove attributes from the >>currently instantiated object. >> >> >> > >I'm not clear on what you mean by "parent" and "child", but here's >what I was trying to address: >
Inheritance. You're original example allowed you to create a parent, create the child, assign a new attribute to the child which is then owned by the parent as well. Dynamic Inheritance, to be exact.
> >> dee: make object! [firstname: "Tweedle"] > >> dum: dee > >> dee/firstname: "Twaddle" > == "Twaddle" > >> dum/firstname > == "Twaddle" > >There's only one object here. There just happen to be multiple >words that refer to it. Any changes to the one object are visible >via any way we can access it. This is different from > > >> dee: make object! [firstname: "Tweedle"] > >> dum: dee > >> dee: make dee [middlename: "Xavier"] > >> dum/middlename > ** Script Error: Invalid path value: middlename > ** Near: dum/middlename > >where "the currently instantiated object" isn't changed at all, but >a new object is constructed and one of the words is set to refer to >that new one. > >If your goals are such that you always have a single specific word >(or some other distinguished reference) that you're using, and >never have to e.g. pass as an argument to a function, keep up with >via a reference in a block, etc. then by all means, ignore the >suggestion for an extra layer. >
My goal was simply to add and remove attributes from an object. Create a new object based on the parent, and then add and remove attributes from that object. Both separate and distinct from one another, but mutable. The object is used as a parent for a class called Parameter! which is then used to provide data to html in name/value pairs. -- Sincerely, | Cold Hearted Orb, that rules the night. Removes Ed Dana | the colours from our sight! Red is gray and Software Developer | yellow white! But we decide which is right... 1Ghz Athlon Amiga | And which is an illusion! | -- The Moody Blues, Late Lament.