Re: Creating a list of numbers from a Contacts group
Re: Creating a list of numbers from a Contacts group
- Subject: Re: Creating a list of numbers from a Contacts group
- From: Shane Stanley <email@hidden>
- Date: Sat, 07 Jan 2017 09:58:27 +1100
On 7 Jan 2017, at 1:09 am, Nigel Garvey <email@hidden> wrote:
>
> It's still not nice.
It's the result of 20 years of codebase that was essentially private being made public by a change in AppleScript. You'll find Script Editor also includes several categories, including on NSDictionary, although on a much smaller scale.
> I made the mistake because, vaguely remembering
> that it was possible to remove objects from arrays, _I_, the scripter,
> found it more convenient to try the likely method name than to launch
> Xcode again and hunt through its documentation to find out if the method
> actually existed. What I tried not only didn't error but did exactly
> what was required.
That's the AppleScript way, but it's a really dangerous thing to do in ASObjC. That's because Objective-C classes can -- and do -- define very large numbers of private methods. And they're private for good reason: they haven't been fully tested, they may have gotchas, or they may still be in development. They're generally not fit for public consumption. But they're private only in that they are not documented -- they can still be called by any code. Fortunately most (but not all) are in fact difficult to use in ASObjC because they include underscores in their names. But if a method is not in the documentation -- strictly, not in the .h files, which the documentation reflects, albeit with a bit of lag and the more-than-occasional error -- you generally shouldn't use it.
> Ideally, a top-flight scripting environment shouldn't be the actual cause of one's errors.
Nice try ;-), but this really is a straightforward user error -- you could have hit upon a private system method with the same result.
What a top-flight scripting environment does is gives you code-completion that tries to show only legal methods by building it's data directly from the public .h files. It's not just about saving typing or memory -- it's also about safety.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
_______________________________________________
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