Re: Variable Ponderance
Re: Variable Ponderance
- Subject: Re: Variable Ponderance
- From: Graff <email@hidden>
- Date: Sat, 02 Oct 2004 01:46:07 -0400
On Oct 1, 2004, at 6:19 PM, has wrote:
Courtney Schwartz wrote:
My personal opinion? I love that AppleScript has reduced objects,
methods and parameters to the equivalent typical English syntax of
subject-verb-object.
Making code readable to non-programmers this way is a brilliant idea,
yes, though the way it's actually implemented is often problematic. I
also think it was a mistake for AppleScript to completely ditch
dialects: while the various human language syntaxes were a
non-starter, a 'real programming language'-like syntax could have been
very useful for educating users about the basic structure of the code
they write. While it's very easy to understand what something like:
tell app "Finder" to set s to name of file 1 of home
does, it's rather harder to understand exactly how it does it, whereas
something like:
s = app('Finder.app').home.files[1].name.get()
is harder for the casual reader to deduce the meaning of, but easier
for the student to observe the underlying structure of.
Bah, I prefer the Objective-C way of doing things:
[app withName:"Finder.app"
setObject:s
toValue:[[home getFileNumber:1] getName] ]
That's perfectly readable if you know just a little bit about
Objective-C syntax! *
:-)
- Ken
* Note:
Objective-C uses messages to objects in the format:
[object message:value]
which translates to
"tell object this message containing this value".
Messages can have no value:
[object message]
or multiple values:
[object part1:value1 part2:value2]
or any mix in-between.
Messages can also be nested if an object returns another object:
[[object1 message_to_1] message_to_2]
is equivalent to:
object2 = [object1 message1]
[object2 message2]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden