Re: Snow Leopard AppleScript Release Notes
Re: Snow Leopard AppleScript Release Notes
- Subject: Re: Snow Leopard AppleScript Release Notes
- From: Shane Stanley <email@hidden>
- Date: Sat, 29 Aug 2009 14:12:48 +1000
- Thread-topic: Snow Leopard AppleScript Release Notes
On 29/8/09 1:38 PM, "BareFeet" <email@hidden> wrote:
> For example, here's a Cocoa method for NSTableView:
>
> selectColumn:(NSInteger)columnIndex byExtendingSelection:(BOOL)flag
>
> and here's an example of using it in Objective-C:
>
> [MyTableView selectColumn:3 byExtendingSelection:TRUE];
Actually, that TRUE should be YES, but...
>
> which I would have expected to appear in AppleScript syntax as:
>
> tell MyTableView to selectColumn of 3 given byExtendingSelection:true
>
> but it instead seems to require syntax like this:
>
> tell MyTableView to selectColumn_byExtendingSelection_(3, true)
>
> This syntax gets increasingly hideous as you use methods with more
> parameters or nest method calls. Positional parameters are not
> "English like" and is a major diversion from the AppleScript strengths.
FWIW, I disagree. Those tortuous
let's-see-if-we-can-make-it-look-a-bit-like-English constructions often end
up just more finicky syntax to remember. Why "of" 3, for goodness' sake?
What's "given"? There's no linguistic reason for them. The whole thing has
such a contrived feel about it. If it could be done with something simple,
like:
tell MyTableView to selectColumn:3 byExtendingSelection:true
then great, but clearly that's not possible in AS.
The use of positional calls is fine, IMO, with the underscores in the
handler name making clear the order. And having the handler names like that
probably makes it easier to look up the relevant Cocoa documentation.
Anyway, if this syntax is the worst thing that can be found to complain
about, it seems to me that we're on a winner.
--
Shane Stanley <email@hidden>
AppleScript Pro Sessions <http://scriptingmatters.com/aspro>
_______________________________________________
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