Newsgroups: rec.arts.int-fiction
From: Suzanne Britton <tril@igs.net>
Subject: Re: [TADS] object copying voodoo?
References: <8ebbc95b.0110310041.726770ec@posting.google.com>
Message-ID: <slrn9u1068.f2.tril@miranda.igs.net>
User-Agent: slrn/0.9.7.2 (Linux)
NNTP-Posting-Host: 216.58.91.12
Date: 31 Oct 2001 16:41:49 -0600
X-Trace: corp.newsgroups.com 1004568109 216.58.91.12 (31 Oct 2001 16:41:49 -0600)
Lines: 56
X-Comments: This message was posted through Newsfeeds.com
X-Comments2: IMPORTANT: Newsfeeds.com does not condone, nor support,  spam or any illegal or copyrighted postings.
X-Comments3: IMPORTANT: Under NO circumstances will postings containing illegal or copyrighted material through this service be tolerated!!
X-Report: Please report illegal or inappropriate use to <abuse@newsfeeds.com>
X-Abuse-Info: Please be sure to forward a copy of ALL headers, INCLUDING the body (DO NOT SEND ATTACHMENTS)
Organization: Newsfeeds.com http://www.newsfeeds.com 80,000+ UNCENSORED Newsgroups.
Path: news.duke.edu!newsgate.duke.edu!news-relay.ncren.net!news-ext.gatech.edu!newsfeed.utk.edu!feed2.onemain.com!feed1.onemain.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator-SanJose!in.nntp.be!corp.newsgroups.com
Xref: news.duke.edu rec.arts.int-fiction:94186

In article <8ebbc95b.0110310041.726770ec@posting.google.com>,
Michael Burschik wrote:

> I am wondering why
[snip]
> 	  ret += objlist[i];
> 	  return ret;
>
> works, whereas
[snip]
> 	  return [ objlist[i] ];
>
> does not. I get the error [TADS-1040: property evaluated for
> non-existent object] instead.

Ah, I remember running into this :-) I *think* it may be a bug in TADS;
Mike Roberts would be able to say for sure, so I'll CC this to him.

What seems to happen is that, in the second example, the entire list objlist
is set as the first element of the returned list, instead of just
objlist[i]. You can correct this behavior just by putting parens around
objlist[i], so maybe it's some weirdness with TADS bracket parsing.

Here's an example program to show off what's happening. Run it and type "push".

#include <adv.t>
#include <std.t>

startroom: room
    sdesc = "startroom"
;

modify pushVerb
    action(actor) = {
        local list1 = [ startroom ];
        local list2 = [ list1[1] ];
        local list3 = [ (list1[1]) ];
        "datatype of list2[1]: "; say(datatype(list2[1])); "\n";
        "datatype of list3[1]: "; say(datatype(list3[1])); "\n";
        "list2[1][1].sdesc: <<list2[1][1].sdesc>>\n";
    }
;

Suzanne

--
tril@igs.net - http://www.igs.net/~tril/
"I'm aware of that, sweetheart. It's just that when I wake up to a hissing
goat skull on my nightstand, and it hops off and runs across the floor on
spider legs, I sleep a lot better knowing where it ran off to."
                                                          - Ted (Red Meat)


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----
