• 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
Forgotten but not gone
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Forgotten but not gone


  • Subject: Forgotten but not gone
  • From: Richard 23 <email@hidden>
  • Date: Fri, 26 Jan 2001 10:31:48 -0800

Who'd've thought looking through old AppleScript documentation
saved as Scriptable Text Editor documents would turn up info
which I had never seen before, is no longer documented, at least
not in the AppleScript Language Guide, yet it still works today,
nearly eight years later.

So, from the annals of scripting yesteryear, I bring back from
the nearly dead... the original linked list.

A list is a list, right? Nope. A list is a vector, at least
the lists we're accustomed to using ever since AppleScript 1.1.

For reasons of efficency due to the common usage of lists the
linked list was put into the closet but not without providing
compatibility with the original data type.

So here's is an example and it's not a typo:

set x to [1, 2, 3]
set y to [4, 5, 6]
set z to x & y
set item 2 of y to 999
z --> {1, 2, 3, 4, 999, 6}

set x to {1, 2, 3}
set y to {4, 5, 6}
set z to x & y
set item 2 of y to 999
z --> {1, 2, 3, 4, 5, 6}

although the class of both comes back as list and the notation
returned uses the curly brace for both, they are not in fact both
vectors. Interestingly you can use the explict coercions "as vector"
for the "normal" list and "as linked list" to get, well, you know.

So that's what those classes were for!

Perhaps someone like a Nebel or an Espinoza could pop in and
fill in the blank... Is the linked list being coerced to a vector
before during the get upon returning the value or is the bracket
notation no longer supported for display.

sadly the method suggested by the documentation has passed on.

<clap on> {} {}

If the two representations need to be distinguished, the
'best type' property may be used:

best type of {1, 2} --> vector
best type of {1, 2} --> vector
best type of [1, 2] --> linked list

<clap off> {} {}

So how do we tell the difference?

I think I'll hold back where the advantages and disadvantages are
for each type of list. We have to keep some secrets, don't we?

R23


  • Follow-Ups:
    • Re: Forgotten but not gone
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: StartupDisk application in Control panel
  • Next by Date: FM scriptmaker and perform applescript step, set access property
  • Previous by thread: Re: StartupDisk application in Control panel
  • Next by thread: Re: Forgotten but not gone
  • Index(es):
    • Date
    • Thread