The FooDoo Lounge

Silent Coercions

Whas is das?

One thing that catches people out with Jon's Commands and Akua Sweets is that they perform silent data type coercions. Whilst this can be seen as helpful when writing scripts, it makes the job of porting them to other machines more difficult.

The main issue with Jon's Commands is with text to file specification coercions, which allow the scripter to supply a string instead of a MacOS file system specification ("fss ") in something like this:

store script myScript in "MacHD:Desktop Folder:scriptFile"

The store script command requires a file specification (or alias) as the value of its 'in' parameter, rather than the path string provided above. This line will work with a valid path on a machine with Jon's installed but will fail elsewhere, because Jon's invisibly coerces the valid path string to a file spec. It should be this:

store script myScript in file "MacHD:Desktop Folder:scriptFile"

Things like this are very easy to miss and can mean that your scripts inexplicably fail on other systems even though you haven't called any of Jon's Commands explicitly.

Akua Sweets performs other type conversions. For a complete list of the coercions performed by either of these osaxen, refer to their respective documentation.

To 'unload' an osax in classic MacOS, the file(s) must be removed from the Scripting Additions folder and the computer restarted. I haven't done it in X, but I'd say it would require a log out, (after removing an osax from your user account) or a restart if the file is in your System folder.


The FooDoo Lounge is Copyright © Richard Morton 2002-2005

|| url:
|| created: 4-Aug-03, 10:29 PM; updated: 4-Aug-03, 11:56 AM
|| size: 8128 bytes