Re: TIDs, my bestest friend
Re: TIDs, my bestest friend
- Subject: Re: TIDs, my bestest friend
- From: has <email@hidden>
- Date: Thu, 8 Aug 2002 12:24:52 +0100
Seth Roby wrote:
>
I found the problem.
>
>
It was not anything to do with the number of things loaded and the
>
misdirection inherent there, but rather the stack and the fact that, many,
>
many calls up, I had an "ignoring punctuation and white space" block, which
>
I was executing inside of.
[This wouldn't affect the TIDs/text items operation as those ignore such
settings, so I'm assuming it was dicing your data somewhere else.]
This wouldn't affect the operation of TIDs
>
Oh, for a good debugger....
Debuggers are overrated.:p Better to write code which you *know* will work
the way it's supposed to.
If it's any consolation, most folk get caught out by sloppy management of
TIDs, considering/ignoring blocks, etc. sooner or later. It's easily done.
(Perhaps it's a flaw in the language design that this is *too* easily done?
It's just something we have to learn to live with though.)
Three suggestions:
1. if you change something then change it back again when done; and avoid
stepping on others' toes in the meantime
2. if you're making assumptions about AS's state, document them (e.g. as
inline comments; actively considering these issues can really help the
design)
3. avoid making such assumptions altogether, and *always* set those suckers
whenever and wherever you do anything that'll be affected by them.
This applies double (nay, triple!) when creating your own libraries: one of
the main points of writing libraries is so you can forget about all the
internal details and get work done just by calling their functions. So make
sure those are 100% robust, and don't be shy of testing them hard using all
sorts of bad input, TIDs set to random values, non-default
ignoring/considering options, etc.
Where you absolutely have to trade robustness in order to scrape every last
ounce of speed, document, document, document [heck, maybe even names such
functions as 'unsafeFindAndReplace()', etc. so you *can't* forget]. But
there's usually a dozen other things that can be optimised before you have
to resort to this. (Personally I'd take a good profiler over a good
debugger *any* day...)
HTH
has
--
(My email address has changed from <email@hidden> to
<email@hidden>. Please update your address books accordingly.)
_______________________________________________
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.