Bindings and object mutability (was Re: Dates gone wild)
Bindings and object mutability (was Re: Dates gone wild)
- Subject: Bindings and object mutability (was Re: Dates gone wild)
- From: Chris Page <email@hidden>
- Date: Thu, 11 Sep 2003 00:40:52 -0700
On Wednesday, September 10, 2003, at 04:18 AM, Nigel Garvey wrote:
Very nicely put! :-) - though I think it might deepen Doug's confusion
about the difference between pointers and references. Everywhere where
you use "refer" above, I'd use "point" to avoid confusion with
AppleScript "references".
I was trying to avoid using "pointer" because it's an implementation
detail. In fact, you don't know or care whether a variable contains a
pointer or an immediate value. For immutable objects, especially
integers, characters, and booleans, it's quite possible it stores the
value directly instead of pointing to it someplace else in memory. This
is exactly why I stressed that variables, properties, etc. are all the
same from AppleScript's perspective, and that the only thing scripters
need concern themselves with is whether an object is mutable.
Terms like "pointer", "pass by reference", and "pass by value" are
AppleScript implementation details not visible to script writers. As
above, it's likely that small, immutable objects like integers are
passed "by value" and others are passed "by reference" using a
"pointer". But you can't tell and don't care.
I wanted to avoid using "refer to" because of the possible confusion
with "a reference to", but the "correct" term is somewhat abstract and
I wanted to keep the explanation simple. Properties, variables,
arguments, and anything else that can "refer to" an object are in some
circles called "bindings". We say that they are "bound to" an object,
and that more than one binding can be bound to the same object. This
provides a more abstract term that covers everything, including
constants, where "variable", for example, wouldn't really be the right
term. But I didn't want to explain all that and add to the confusion.
Perhaps an alternative term is "name". You can say that variables,
properties, etc. "name" objects, and that objects can have more than
one "name". However, trying to describe it that way can have its own
confusions, especially considering "name" is both a noun and a verb.
Also, in my opinion this approach talks too much about the object
having names, when what we're primarily concerned with here are the
bindings, really.
--
Chris Page - Software Wrangler - Palm, Inc.
That's "Chris" with a silent *and* invisible "3".
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.