> So this used-to-work but for reasons  of our own protection
> has been made unworkable?

  Right, what happens if you remove one of the values from the
  middle of the value block?  Do all the other words now point
  to new values?  What does the word at the end point at?
  Likewise, adding a new word without a corresponding value.
 
> perhaps  I should try  another  track... 

  Are you opposed to using blocks inside objects?

> most object based
> systems try   to   respect that an   object  should  resist
> external   change  and   only  undergo transformation  when
> initiated from within.  you cant change an object unless it
> wants  to change {reminds me of  an old light bulb joke} or
> provides an access method to facilitate the change.
> 
> can  a   function  be  made   (within  the   object)   that
> self-extends  the object?   what would  that  function look
> like?

  Yes, using blocks. 


obj: make object! [
    a: [b: 2]
]

obj/a/b: 4

obj/a/b
== 4

append obj/a [c 6]

obj/a/c
== 6

etc..



  If you were sadistic, you might use self modifying
  functions. Here's a rather counter intuitive way to add and
  remove refinements from an object:

fobj: make object! [ 
    p-words: [] 
    path: func refs: [/add what /remove who] body: [
        either add [
            path: func head insert refs to-refinement what body 
            append p-words what
        ][ 
            either remove [
                system/words/remove find p-words who
                system/words/remove find refs to-refinement who
                path: func refs body
            ][
                foreach item bind p-words 'add [
                    print [item "==" get item]
                ]
            ]
        ]
    ]
]

fobj/add 'a
fobj/add 'b

fobj/remove 'a

    Of course this isn't that much different from using
    blocks, though, and you still have to add logic in the
    body of the function to act on the activation of different
    refinements.

    Blocks are a much better and simpler way to go. 

    -jeff

Reply via email to