English 中文(简体)
In Rebol how to get the Parent in an Object Path?
原标题:
  • 时间:2009-12-12 11:22:53
  •  标签:
  • rebol

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

parent-of system/console/history

would give

system/console
最佳回答

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 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.





相关问题
Rebol Email Pop Server error

I have tested pop successufully with some POP servers with Rebol but it doesn t work with my hosting server dreamhost (which works with Outlook I have tested http://wiki.dreamhost.com/Outlook_Express )...

Rebol and /local Object

The new function below doesn t work if Obj is local. If I remove it from /local it works. So what to do to make it work with a local Obj thanks ? Sure not hard for you. Person: make object! [ Person:...

In Rebol How to get the Object Path Name (String)?

Let s say I have list: [system/history system/prompt] I want to convert to list-string: ["system/history" "system/prompt"] This may be an obvious answer but I can t see any :) Thanks.

What new Widgets in Rebol 3 Vid? [closed]

Rebol 2 VID was hugely missing Dropdownlist and Treeview, I have made a search on Rebol 3 on Google but couldn t find anything except a discussion. So what will Rebol 3 VID really include as new ...

热门标签