why these exist? seems absurd. dynamic languages, applescript types seem either immutable primitive types integer
s , real
s going handed around value , don't make sense use a reference to
, or object-like types application
s, script
s, or record
s, being passed around reference already. how a reference to
not redundant? here's example taken apple's applescript language guide (http://developer.apple.com/library/mac/#documentation/applescript/conceptual/applescriptlangguide/introduction/aslr_intro.html if you've lost link):
tell app "finder" set diskref ref startup disk --result: startup disk of application "finder"
so mean tell me if did instead,
tell app "finder" set diskobj startup disk --result: startup disk of application "finder"
that applescript runtime going send apple event sent across finder process telling it, "hey - guy asked return octet stream of /dev/disks01 me! haha! guess should have asked a reference to
it! let's started! going take while!"
i'm programming in python , this:
m = filehandle.read( 1000000000 ) #and wait little while n = m
did copy gig of data around in memory? of course not. existence of a reference to
in applescript implies assigning objects new variables by-value operation. , if that's case, what's deal copy
command?
what's going on here?
update: well, consider me confused python programmer. make bit more clear, still think
tell app "finder" set diskref ref startup disk --result: startup disk of application "finder"
is poor example (taken applescript language guide). @chuck's example of a reference to
property holding primitive type can reassigned better one. iow, reference
object variable/property holds pointer variable or property.
my understanding can think of references pointers.
set x = 5 set y reference x set contents of y 10 log x -- 10
in general, don't manually create references. applescript libraries , dictionaries may return them, work properties of returned item (name of startup disk
example).
honestly, i'd ignore them. in twenty years of working applescript, i've had documentation references once. if you're trying in applescript , believe need create reference variable, you're not doing in straightforward manner.
check out this mactech article more detailed discussion of applescript references.
Comments
Post a Comment