tags:

views:

33

answers:

2

Is there a function to get the parent of an object for example

parent-of system/console/history

would give

system/console
+1  A: 

It seems that you don't realise that a path! value is a type of series! value:

>> path: 'system/console/history   
== system/console/history
>> type? path                   
== path!
>> series? path                 
== true

So just remove the last value in the series:

>> path: head remove back tail path
== system/console
Peter W A Wood
+1  A: 

Peter is right if the history object has just one parent. But it may have others:

my-block: copy []
append my-block system/console/history

my-object: make object! [history: system/console/history]

history is now has three legitimate parents:

  1. system/console
  2. my-block
  3. my-object/history

Which you consider to the the real parent is really up to you. There is no easy way that I know of to find all the contexts an object (or block) is part of.

Sunanda