Path: news.cs.au.dk!not-for-mail From: Wilfried Rupflin Newsgroups: comp.lang.beta Subject: Re: Cannot copy NONE? Date: 12 Nov 1999 09:22:01 -0000 Organization: University of Dortmund, W-Germany Lines: 69 Approved: mailtonews@cs.au.dk Distribution: world Message-ID: <19991112092201.7475.qmail@noatun.mjolner.dk> Reply-To: Wilfried Rupflin NNTP-Posting-Host: daimi.cs.au.dk X-Trace: xinwen.cs.au.dk 942399521 9175616 255.255.255.255 (12 Nov 1999 09:38:41 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 12 Nov 1999 09:38:41 GMT Xref: news.cs.au.dk comp.lang.beta:12163 Hi! >I found something quite interesting which does not help to generate >compact code - instead it becomes a bit complicated: > > t,u:^text; > do > none->t[]; > t.copy->u[]; > > *** THIS GIVES A "REFERENCE *** > *** IS NONE" RUNTIME ERROR !! *** Why not simply ... t,u: @text; do (* ''->t; ... or ... t.clear; ... or ... ... [in fact: not required here] *) t->u; >Well, normally one would not set a text reference to none, but if I read >some data into an array (^text) and just want to copy the values (not >the references!) of the corresponding variables into the array (or to >any other text reference), it is not possible to do this with small code >if it's possible that there are NONEs in there. >Sascha Kimmel In my experience in most cases where text references are used text (part) objects would be appropriate. There are a few exceptions only: Consider e.g. make_something: (# t: @text; ... do ... exit t[] #) Since t[] references a part object the whole enclosing object would be kept which could be pretty big in some cases. (The lesson: don't use mixed modes, i.e. either make_something: (# t: @text; ... do ... exit t #) or make_something: (# t: ^text; ... do ... -> t[]; exit t[] #) -- unless you know what you are doing, of course.) Cheers Wilfried Rupflin