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

[REBOL] Re: Styles, 'with, shared stuff & confusion ...

From: al:bri:xtra at: 14-Nov-2000 15:54

pekr wrote:
> last two or three weeks I try to use /View for various purposes, and am
struggling with strange /View behavior and in my opinion the rebol object architecture is the reason for unwanted behavior ....
> As we know: once you create clone of object, you will receive separate
context, except the subobjects - they are shared. I am not sure what it is good for (memory saving?), but I remember Carl's message to one of the latest /View releases, stating "more stuff is copied now" or something similar. This could help you, pekr. It clones a object! and correctly copies objects that are members. [ Rebol [ Name: 'Clone Title: "Clone" File: %Clone.r Home: http://members.nbci.com/AndrewMartin/Rebol/Enhancements/ Author: "Andrew Martin" eMail: [Al--Bri--xtra--co--nz] Date: 17/October/2000 Version: 1.0.0 Enhancement: 'Clone Acknowledgements: "Erin A. Thomas" Purpose: { Clone objects by copying objects inside. } Example: [ New_object: Clone Original_Object [] ] ] Clone: function [ {Clones all sub-objects and hashes, so there are no multiple references.} [catch] Object [object!] "The object to clone." Block [block!] "Extra code for this object." ][ Cloned Member ][ throw-on-error [ Cloned: make Object Block foreach Word next first Object [ Member: get in Cloned :Word if same? Member get in Object :Word [ set in Cloned :Word either object? Member [ Clone Member [] ][ either any [ series? Member port? Member bitset? Member ][ copy/deep Member ][ Member ] ] ] ] Cloned ] ] ] Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/