Re: Tid's 'n AS
Re: Tid's 'n AS
- Subject: Re: Tid's 'n AS
- From: bill fancher <email@hidden>
- Date: Fri, 08 Nov 2002 01:55:43 -0800
On Thursday, November 7, 2002, at 02:10 AM, Michael Terry wrote:
On 11/5/02 1:13 PM, "bill fancher" <email@hidden> wrote:
There IS no default value for tid's. That would be the case if you
could say:
set abc to text items of "abc" with text item delimiters x
and if the statement
set abc to text items of "abc"
were equivalent to
set abc to text items of "abc" with text item delimiters ""
There's an INITIAL value given to tid's by AS. There's a CURRENT value
for tid's. But there's no default. Assuming that the current value is
the initial value (or anything else) or that there's a default is
where
the problem lies.
An environment setting an initial value is the very definition of
'default'.
That's one usage of "default", but it fails to make the distinction
between a value that's used if nothing else is specified and the
current value of a variable or property that's always used.
E.g. the "do script" command has a default value for the optional "in"
parameter: "AppleScript". If you say
do script x in "JavaScript"
do script y
The default value is used in the second statement, but not the first.
OTOH, if you say
text items of x
the default value (in your sense) is always used. I was merely trying
to point out the difference.
The method or persistence of the setting doesn't make any difference.
Not in your usage of the word, which, as common as it is, conflates the
two cases above. But given that, how would you make the distinction?
I'll happily adopt whatever terminology you prefer, but the difference
won't vanish as a result.
On Wednesday, November 6, 2002, at 06:39 AM, Michael Sullivan wrote:
Another fundamental tenet of defensive programming is to assume your
users (including programmers who use your functions) could make any
*reasonable* assumption, even though they shouldn't, and make it work
they way they would expect unless there is a non-trivial cost to
doing
so.
Assuming some value for tid's (e.g. "") is NOT reasonable.
Yes it is, otherwise most people wouldn't do it.
Most people in the U.S. didn't vote last Tuesday, so I assume you'd
argue that it's reasonable to shirk one's duty as a citizen and that
those who did vote were being unreasonable.
Your also presuppose that most people "do it". No one I've heard from
prior to this admits to it, and no one other than you has advocated it.
Everyone else has claimed they always set tid's before use (and restore
them afterwards.)
People aren't dumb.
People who assume that tid's will always be set to "" are. (Present
company excepted, of course.)
The only "side" whose code will break is the one that uses tid's
without setting them. Doing that is a BUG in your code.
Oh, really?
Sure. Give me script that uses tid's without setting them first and
I'll give you a script that loads yours and makes it misbehave.
Why does AS give a default value to TIDs, then?
A property HAS to have SOME value (even if it's "missing value"). That
doesn't mean that you can assume it hasn't been changed from its
initial state.
People make mistakes. That's a fact. To assume people will always
"restore" tid's is unreasonable, particularly when you're talking to
some yahoo who says he never bothers.
Using Paul Skinner's toilet seat metaphor: If you make sure the seat is
down before you sit you'll never fall in the toilet (even if you have
John Delacour over for a visit.)
--
bill
"Facts are stubborn things; and whatever may be our wishes, our
inclinations, or the dictates of our passions, they cannot alter the
state of facts and evidence." - John Adams
_______________________________________________
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.