Re: Month as Integer (or he's ranting again)
Re: Month as Integer (or he's ranting again)
- Subject: Re: Month as Integer (or he's ranting again)
- From: Bill Briggs <email@hidden>
- Date: Sat, 2 Dec 2000 15:15:13 -0300
At 11:58 AM -0500 02/12/00, Marc K. Myers wrote:
What does the "as item" do in this construction? This whole redefinition
of "log" is a great idea and I want to understand it, but I get the same
results with "as item" or without it. I don't find "item" as a value
class in the AppleScript Language Guide, but the compiler accepts it as
a coercion so it must be a value class and not just an element of the
list value class. Or is it?
It's an umbrella that includes objects or values of different
classes. In the Finder you can easily see how "item" is a catch-all.
Assuming you have 10 items on your desktop, just run this in Script
Editor with the event log open and observe what is returned.
tell application "Finder"
repeat with i from 1 to 10
get class of item i of desktop
end repeat
end tell
None of those things are of class "item", because there isn't one.
They are of class trash-object, disk, folder, alias file, etc.
In other contexts "item" includes other things. In a list, the
particular "item" has a class of whatever it happens to be; string,
integer, real, alias, etc. It can be of any class, or it can be an
expression that includes members of several classes. As far as the
list is concerned an item is just some arbitrary member of the list
that's addressable by it's index (all of the reference forms for a
list just point to members by location), but for the purpose of
addressing it, its actual value class is of no particular consequence.
As you pointed out, the "as item" does nothing in that construction.
- web