• 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: robust handling of return values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: robust handling of return values


  • Subject: Re: robust handling of return values
  • From: patrick machielse <email@hidden>
  • Date: Mon, 14 Nov 2005 13:47:28 +0100

Op 12-nov-2005, om 21:00 heeft Richard Morton het volgende geschreven:

On 12 Nov 2005, at 1:21 AM, patrick machielse wrote:
should I use:
    set addedTracks to add {list of tracks}
    try
        get addedTracks
        if ( "class of addedTracks is list" )
            -- it is a list
        else
            -- it is a file track
        end if
    onerror
        -- nothing returned
    end try

This seems a bit unelegant, using exceptions for flow control. There
must be a better way around this.

A related question: why wouldn't the 'add' command just return an
empty list if no tracks were added? Why make it difficult?

Indeed. I think it should always return a list. One could still ask why you are passing empty lists to the 'add' command though. AppleEvents are costly - avoid them if you can reasonably do so.

I already take care not to add an empty list of file aliases. I pass iTunes the contents of a folder, and let it figure out which files it can add to the library. iTunes then returns a list of file tracks, or 'nothing' if none of the passed files could be added. So I can't prevent receiving a 'nothing' value.


patrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: when words aren't words
  • Next by Date: Re: robust handling of return values
  • Previous by thread: Re: robust handling of return values
  • Next by thread: Re: robust handling of return values
  • Index(es):
    • Date
    • Thread