After the big release of 1.0.3a on Tuesday, a reader in England found some bugs I had missed in the first go-round with Manila Envelope on Jaguar. Specifically, people using the software for the first time can’t post!
The problem was a result of two things. First, the problem with Jaguar requiring plain text for XML-RPC extended into an additional function call that I hadn’t investigated, one that passed a URL as one of its parameters. This particular call only happens if no successful calls to the server have been made before, so I didn’t catch it in my haste to release 1.0.3a. Once again the importance of thorough testing…
Second, I made a big fuss about the importance of separating user interaction from business logic back in February, but didn’t catch all the problem areas. This particular problem was caused by a function that returned a string value. In the first implementation, I had the calling functions make the assumption that an empty string meant an error had occurred. Only problem: if the calling function in the UI is handling error notification and I’m returning a single empty string parameter, there’s no way to provide detailed error information.
This is where I miss “pass by reference” in other programming languages. It then becomes simple: you pass in a variable to be transformed by the method, and you check a return value for success or failure. Instead, I am using multiple return values:
return [Macro error: Can't compile this script because of a syntax error.]
which means I have to use AppleScript’s copy
syntax instead of a simple set
. Ah, growing pains.