Shane,
Thanks for sharing your thoughts on handlers.
I get your point that interleaved parameters are easier to understand when viewing the code.
The downside is that they are way more verbose, require a lot more typing, and now I have to remember not just the parameters, but the exact spelling of the parameter name.
I suppose this is a matter of personal preference.
You probably won't like this, but Visual Basic (and VBA) offered the best of both:
- You could call the function with parameters in positional order
OR - You could call the function with named parameters.
It would be great if AppleScript supported this syntax.
One benefit of using Script Debugger, is that I can start typing my script library handler name, press ESC, and get the complete handler call, including placeholders of my parameter names.
So if I saw this in code:
my findReplaceInMatchingCase(theModel, theName, theBody, true)
I could just enter a new line like this:
my find
then press ESC
To see this:
findReplaceInMatchingCase(theFind, theReplace, theText, matchCaseFlag)
Best Regards,
Jim Underwood
aka
JMichaelTX
my findReplaceInMatchingCase(theModel, theName, theBody, true)
But it's still an effort to understand.
Here's an interleaved equivalent:
on findText:theFind inText:theText replaceItWith:theReplace matchingCase:matchCaseFlag