Re: My ASObjC app keeps crashing.
Re: My ASObjC app keeps crashing.
- Subject: Re: My ASObjC app keeps crashing.
- From: Shane Stanley <email@hidden>
- Date: Sat, 31 Jan 2015 12:10:29 +1100
On 31 Jan 2015, at 10:29 am, Brian Christmas <email@hidden> wrote:
>
> 1. My scripts are heavily documented. I want someone else to be able to understand my code if I ever get hit by a bus. Will the compiled script be any smaller if I remove the commenting?
No. A lot of commenting can make a difference on whether a script *will* compile, but that should be all.
>
> 2. My number of properties is considerable. In fact, after I read a note on MacScripter, I only use properties and not global variables. Would changing some properties to globals possibly free up whatever is causing my crashing?
You could try it, but I very much doubt it. I think your problem is just the sheer amount of stuff.
>
> 3. I have two scripts that I think (with my limited knowledge on libraries) be able to be converted to libraries. Would using libraries free up the complied or running script (or whatever it’s called) space so hopefully avoiding the crash?
There's only one way to find out for sure, but I suspect not. They still have to be loaded to be used. If I had to guess, I'd say it might help postpone crashes, with some code being loaded when needed rather than at startup.
>
> 4. I have experimented with my main script, and it seems that anything over 200 KB in size won’t compile. I know you’ve told me that I should limit my scripts to about 1800 lines (I’ve sometimes gone up to 6,500, before splitting them), but restricting to 1,800 lines would mean 3 more split up scripts. Splitting my main script even further will be difficult, there’s a lot of subroutines that use properties. Would splitting them up possibly stop my crashing?
Probably not.
>
> 5. Cannot find the answer anywhere to this, do global variables persist between main and secondary scripts, please?
No. In an Xcode app built using ASObjC there's no such thing as a main script -- they're all classes.
>
> I’ve purchased your Everyday_AppleScriptObjC_2ed, and am about to start reading it.
Just note that it's really about using ASObjC in scripts *outside* Xcode -- normal scripts you write in Script Editor or wherever. The rules are slightly different there.
And to answer the un-asked question: I suggest you try breaking your app into smaller apps. Perhaps some of the secondary stuff can be handled using watched folders. ASObjC is still based on AppleScript, and it has limits -- you can't just keep scaling things bigger and bigger. Put simply, I suspect you're asking more of it than it's capable of.
(If you look at 'Objects vs. Records in Tables' in chapter 7 of my book, you'll see another example of how AppleScript doesn't scale to bigger projects. It just wan't designed for it.)
You might be able to solve your immediate problem -- perhaps getting rid of a swag of properties might help. You might hit on the magic tipping point. But I fear the scale of your project is ultimately un-maintainable. If I'm right, the sooner you start breaking it down, the sooner you'll start sleeping better.
Sorry to sound so pessimistic, but I'd hate to give you false hope.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden