• 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: Variable parameter lists and more! (was Re: wishlist: user-declared parameter labels without "given"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variable parameter lists and more! (was Re: wishlist: user-declared parameter labels without "given"


  • Subject: Re: Variable parameter lists and more! (was Re: wishlist: user-declared parameter labels without "given"
  • From: Paul Berkowitz <email@hidden>
  • Date: Sun, 01 Apr 2001 18:58:59 -0700

On 4/1/01 7:08 PM, "Timothy Bates" <email@hidden> wrote:

> I just found out two fantastic things:
>
> 1. If you write a handler to take a record as its input, it unpacks them
> automagically, and doesn't care what order the items are in.

True for everything to do with records: records are not ordered. The label
provides all identification needed. This can be really useful at times.


> 2. And more fantastic: this allows us to have optional parameters (I just
> read Paul and Arthur's mails more closely and Arthur in fact noted this
> already.
>
<snip>
>
> Rock on! that is so powerful.

Yup! Even:

do1ofseveralthings({task:"beep", parameters:{}})
do1ofseveralthings({task:"add", parameters:{2, 2}, aWord:"See-ee?"})

on do1ofseveralthings(anyRecord)
set thisThing to anyRecord & {aWord:"beep"}
set {task, aWord, parameters} to thisThing's {task, aWord, parameters}
if task = "beep" then
beep
else
display dialog (item 1 of parameters) + (item 2 of parameters)
end if
say aWord
end do1ofseveralthings





--
Paul Berkowitz


References: 
 >Variable parameter lists and more! (was Re: wishlist: user-declared parameter labels without "given" (From: Timothy Bates <email@hidden>)

  • Prev by Date: Re: List within a List
  • Next by Date: Re: [Admin?]
  • Previous by thread: Variable parameter lists and more! (was Re: wishlist: user-declared parameter labels without "given"
  • Next by thread: Re: Variable parameter lists and more! (was Re: wishlist: user-declared parameter labels without "given"
  • Index(es):
    • Date
    • Thread