• 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: bug or feature?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: bug or feature?


  • Subject: RE: bug or feature?
  • From: Joe Kelly <email@hidden>
  • Date: Mon, 24 Dec 2001 12:21:37 -0800

Paul Berkowitz hat geschreibt:
> It might be nice if it actually canceled with an error number
> -128, as the
> user expects, IF the button says "Cancel" on it, perhaps. But
> since you can
> actually change the name of that button to say other things,
> you need to
> have 'false' as a way of keeping the script going to do other
> things if the
> user pushes that button when it says, perhaps "Help".
>
> So, yes, you need to trap for false.
>

When I first used "choose from list" I assumed that if the user pressed
cancel, it would return an empty list {}. So I could do something like "if
theChoice is not {} then". This makes perfect sense if I specify "without
empty selection allowed" -- if I get an empty selection, no sweat, I'll
assume the user canceled.

Unfortunately, choose from list returns one of two basically un-coercible
types: list and boolean. In theory it would be odd but acceptable (as I see
it : ) to provide built-in coercion of class boolean and class list:

{a, b, c} as boolean --> true
{} as boolean --> false
true as list --> {true} (as is presently implemented)
false as list --> {} (present implementation evals to {false})

Happy Holidays fellow scripters!

joe


  • Follow-Ups:
    • Re: bug or feature?
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Definitely a bug
  • Next by Date: Re: bug or feature?
  • Previous by thread: RE: bug or feature?
  • Next by thread: Re: bug or feature?
  • Index(es):
    • Date
    • Thread