Re: copy & set statements
Re: copy & set statements
- Subject: Re: copy & set statements
- From: has <email@hidden>
- Date: Tue, 23 Oct 2001 23:41:04 +0100
Timothy Bates wrote:
>
On 23/10/01 11:08 PM, "Nigel Garvey" <email@hidden>
>
wrote:
>
> on myHandler(myList)
>
> set item 1 of myList to "a" -- make a change within the list
>
> end myHandler
>
>
>
> set theCat to {"woody", "hungry"}
>
>
>
> myHandler(theCat)
>
> return theCat
>
>
>
> -->>{"a", "hungry"}
>
>
Demonstrating that, indeed, handler parameters ARE passed as pointers and
>
others as values. Geeze, that is a really bad inconsistency in the
>
language, and one of which I was unaware.
There was a time when I was also unaware of this problem - until I got
_burned_good_ by it... Cos just when I thought I'd got the hang of this
programming lark, I ran into this little beauty - not that I knew what it
was at the time. Three days later I had two huge black rings round my eyes
and my code looked like an explosion in an alphabet soup factory. Not
pretty. Tracking down such a bizarre bug in a 70K script turns out to be an
exercise in absolute futility when it's not the damn script that's at
fault.:(
It's hard to justify time spent writing scripts when something like this
means you could have done the job quicker by hand after all.
Don't get me wrong: data sharing is a sound concept. Less data copying =
increased speed and reduced memory requirements (if anything there ought to
be _more_ of it). But AS really needs to pay more attention to what's going
on and just DO those copies as needed. Perhaps a smarter compiler would be
the answer?
I dunno, this is getting beyond me. S'probably why I'm writing in
Applescript and not C++ or some "real" language. i.e. "Dear Apple, please
make Applescript smarter so I can be dumb (and not have to worry about it)."
has