• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: is Shane's advice being collated?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is Shane's advice being collated?


  • Subject: Re: is Shane's advice being collated?
  • From: 2551 <email@hidden>
  • Date: Fri, 21 Nov 2014 20:08:46 +0700

Well, we're making progress, though I suspect not even you or I care much at this stage, let alone anyone else, but let's see if we can't wrap this up (at least from my end).

Huh? You can have your script return a list or record or whatever you like -- your method is always going to return you a string (or nil). That's one of the limitations of that whole NSTask approach.


Yep, I already pointed out that was a mistake. I was thinking of a similar but related method I have that calls any NSTask not just OSAScript and has an (id) return.


ii. even if the intended result was an NSString, if the result was null, Shane's amendment would likely cause a crash/

This is true. It should probably check replyData and return whatever you think is appropriate for no result. But the whole thing is just getting more complicated. 

This, indeed, is the point I've been trying to make...I can compare strings REAL EASY in vanilla AppleScript compared to in Cocoa, where I need to know what's in my NSString and whether it needs stripping or not.


Any operations you want to do on the result (like stripping a string), need to be done at the caller's end.

And there's more code, and more chances to introduce bugs. 

Well...let's just not code at all then! The caller should know what it wants returned and how to handle it appropriately. That's just basic coding strategy.


But let's get back to where this started. You said: "at least from my own POV, ASObjC doesn't seem to have any natural place where it excels on its own".

Good. Let's talk about this because the whole attempt to pull apart my NSTask method is irrelevant. That method was an instrument to demonstrate some *facts", namely that you have to know what's in your NSString before you start willy-nilly throwing around comparison code, whereas in AS you can compare strings without worrying about the null terminus.

But yes, I'll concede you've made a case that Cocoa programmers who want to do some AppleScripting might benefit from using ASObjC. As I said to you off-list, I'll give it a go the next time I need to call some applescript from a cocoa method 

(so, again, this was an unncesssary sleight: 

Feel free to keep ignoring it. 

since I'd already said to you I'd try it out).

However, if it's greater take-up that you want, and the best chance of that is Cocoa developers adopting ASObjC as bridging code, then the way forward is to start talking up ASObjC in those forums and arenas, and ideally to exemplify some really useful methods that Cocoa programmers could adopt to get them interested to begin with. I know you've said some such exist here and there, but I've never seen them, and I spend a lot of time in the forums (lurking largely), so they're not exactly getting much attention these days (last 2 years, I've read pretty much every Cocoa-Dev thread on a daily basis and I can't recall anyone ever posting anything about ASObjC).

It seems clear from your own comments and those of others on the list that among the majority of AppleScripters ASObjC is largely seen as a bit of a (cringe for the pun...) bridge too far. But hey, there's other ways to promote both ASObjC and your books, which again I've mentioned to you off list and won't repeat here.

And with that, I'm putting this to bed. Say what you like, I have some apps to write, and I'm off to go do some Cocoa coding :-p). 



Best


Phil  


 _______________________________________________
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

References: 
 >Re: is Shane's advice being collated? (From: Charles Arthur <email@hidden>)
 >Re: is Shane's advice being collated? (From: Shane Stanley <email@hidden>)
 >Re: is Shane's advice being collated? (From: 2551 <email@hidden>)
 >Re: is Shane's advice being collated? (From: Shane Stanley <email@hidden>)
 >Re: is Shane's advice being collated? (From: 2551 <email@hidden>)
 >Re: is Shane's advice being collated? (From: Shane Stanley <email@hidden>)
 >Re: is Shane's advice being collated? (From: 2551 <email@hidden>)
 >Re: is Shane's advice being collated? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: is Shane's advice being collated?
  • Next by Date: Re: Scripting alerts
  • Previous by thread: Re: is Shane's advice being collated?
  • Next by thread: Re: is Shane's advice being collated?
  • Index(es):
    • Date
    • Thread