• 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: Record/List Coercion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Record/List Coercion


  • Subject: Re: Record/List Coercion
  • From: "Mark J. Reed" <email@hidden>
  • Date: Tue, 29 Apr 2008 21:01:20 -0400

Once more, with feeling:  Records are not associative arrays.

They're records.  Like the kind you get Pascal/Modula/Ada "record"
keyword.  Like C "structs".  You'll note that those languages don't
have any kind of "loop through a record" construct either.  The labels
are strictly a compile-time thing, not runtime "keys" used too look
the values up.   You, the programmer, are expected to know, when you
write the program, exactly what fields the record has, which makes
introspection of the sort under discussion unnecessary.

If you simply must loop through a list of values, you can construct
the list manually:

tell myRecord to set myList to { myField1, myField2, myField3, .... }

and then you get the fields in whatever order you choose.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Record/List Coercion (From: "Tom Chen" <email@hidden>)

  • Prev by Date: Re: View Options
  • Next by Date: Re: AppleScript with 6 input fields
  • Previous by thread: Record/List Coercion
  • Next by thread: Re: Record/List Coercion
  • Index(es):
    • Date
    • Thread