• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: TIDs info summary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TIDs info summary


  • Subject: Re: TIDs info summary
  • From: Paul Skinner <email@hidden>
  • Date: Mon, 11 Nov 2002 09:45:40 -0500

On Sunday, November 10, 2002, at 05:46 AM, Richard Morton wrote:

On Sunday, November 10, 2002, at 06:18 AM, bill fancher wrote:

...The fact that we can invisibly or unexpectedly alter tid's is the result of a design decision. There were probably compelling reasons for that decision but it creates pitfalls. Rather than constantly alerting people to the ensuing dangers, the general consensus seems to be that we should assiduously paper them over. That we should make it easy for people to write buggy code and get away with it, and harder for them to find their errors and learn from them.

That's certainly one aspect of the argument, and I agree that any practice that hides coding errors is not good if that's all it does, but there is another issue. In psuedo code:

set tids to someValue
set t to text items of someSting
repeat with n from 1 to count of t
if item n meets someCondition then
drop into handler that uses tids to process the item
else
whatever
end
end
continue with processing that relies on tids being set to someValue

If the handler does not restore tids, the subsequent processing will break.

In this case I belive Bill Fancher would say you should just reset them after the handler is done and before you do any subsequent processing.

snip

set tids to "/"
set t to text items of "disk/folder/subfolder/file"
set containerList to {}
repeat with n from 1 to count of t
if item n of t is "file" then
--drop into handler that uses tids to process the item
doFileyStuf() -- Changes the TIDs but doesn't reset them
else
--whatever... Like, List all containers...
set the end of containerList to item n of t
end if
end repeat
--continue with processing that relies on tids being set to someValue
--You miss the point right about here. If you want the TIDs to be set, then set them.
set AppleScript's text item delimiters to "/"
set containerPath to containerList & "" as text
--"disk/folder/subfolder/"

on doFileyStuf()
--Do something that changes the TIDs
set AppleScript's text item delimiters to ":"
end doFileyStuf

snip

I suggested nested handlers as the only valid reason I know of for storing and restoring the TIDs within handlers in a recent post to this thread;
--
Paul Skinner
_______________________________________________
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.
References: 
 >Re: TIDs info summary (From: Richard Morton <email@hidden>)

  • Prev by Date: RE: [VIRUS] Applescript-Users you have a greeting card
  • Next by Date: Applescript menu in Jag Mail
  • Previous by thread: Re: TIDs info summary
  • Next by thread: Re: TIDs info summary
  • Index(es):
    • Date
    • Thread