Re: Flogging a dead horse
Re: Flogging a dead horse
- Subject: Re: Flogging a dead horse
- From: Bill Briggs <email@hidden>
- Date: Tue, 4 Mar 2003 14:39:55 -0400
At 11:32 AM -0600 04/03/03, Wallace, William wrote:
Bill Briggs first brought this idea to my attention when he posed the
question:
Why would you write an object reference in your script if you didn't
intend for it to be evaluated?
John D expanded on this some what when he wrote:
If 'say' needs a string, then 'say' ought to make sure it gets one.
I'm guessing that the answer to Bill's question is: "you wouldn't".
Precisely.
I'm also guessing that in lower level lanuages, JD's statement is
false because it would be the programmer's burden to make sure he or
she is passing the right kind of data to the function
Where you are required to define variables as specific data types, yes.
however Applescript is intended (I thought) to shift this burden
away from programmer (scripter) thus making the language more
accessible to a wider range of people.
Right. If there's an allowed coercion between the two data types,
AppleScript generally does it behind the scenes so you, the user,
don't have to worry about it.
Now, being that I don't have a great deal of experience or expertise
in this field, I'm just looking for a little verification or
correction. I can't think of any reason to refer to an object
without intending to act upon it in some way. To my thinking, an
object reference is kind of a virtual assignment operation--you are
setting the contents of "some object reference" to the value of the
data actually described by that reference. Does that make sense, or
am I wrong-headed in my conceptual paraphrasing?
Yes, you're getting the data pointed to by the reference and
assigning it to the result variable or some other specified variable,
or using it directly as an input to a larger calculation for which it
is only one of several inputs. But yes, in essence it points to some
data and that's what you get when it's resolved.
And if that's so, then a handy rule of thumb might be that if I have
to explicitly "get" data, then either I have done something wrong in
my code, or there is something lacking in the interpretation of my
code. Does this seem right?
Unlikely to result from an error in your code. If you have to use
"get" then the reference isn't resolving and it is likely not
something you can correct without the get (though if I thought about
I might construct something that shows that statement to be untrue).
I guess you could call the "get" a metaphorical poke in the ribs to
the reference to resolve itself and get the object/property pointed
to.
And doesn't it seem wrong that I am having to think so hard about
these issues?
That's the general idea.
Doesn't it seem contrary to the entire concept of Applescript? Isn't
Applescript supposed to be a small step in the direction of my
*Grandma* being able to tell her computer to find her recipe for
applecrisp and then make a shopping list of all the ingredients that
she doesn't have enough of and then order all of it from peapod and
then preheat the oven?
When Michelle becomes a Grandma that'll be true (LOL). But yeah,
it's supposed to make it more approachable, but I don't see a lot of
grannies at any AppleScript events I've attended.
- web
_______________________________________________
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.