• 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: Script Libraries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script Libraries


  • Subject: Re: Script Libraries
  • From: Shane Stanley <email@hidden>
  • Date: Mon, 20 Jun 2016 12:37:58 +1000

On 20 Jun 2016, at 12:25 PM, Jim Underwood <email@hidden> wrote:

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.

Only if you actually *type* them.

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.

Well yes. But you can do *exactly* the same thing with interleaved syntax.

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)

So if I saw this in my code (or it's in the code of a library I'm using):

on findText:theFind inText:theText replaceItWith:theReplace matchingCase:matchCaseFlag

I could just start a new line like this:

my find   then press ESC

To see this:

findText:theFind inText:theText replaceItWith:theReplace matchingCase:matchCaseFlag

No different -- in both cases you end up with placeholders for the parameter values.

But there is a downside to interleaved syntax. Each parameter name is a new identifier, so you have to ensure parameter names don't clash with defined terms when you first write them. But Script Debugger 6 will generally escape them in pipes as you type them if there's a clash.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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

  • Follow-Ups:
    • Re: Script Libraries
      • From: Jim Underwood <email@hidden>
References: 
 >Re: Script Libraries (From: Jim Underwood <email@hidden>)
 >Re: Script Libraries (From: Shane Stanley <email@hidden>)
 >Re: Script Libraries (From: Jim Underwood <email@hidden>)

  • Prev by Date: Re: Script Libraries
  • Next by Date: Re: Script Libraries
  • Previous by thread: Re: Script Libraries
  • Next by thread: Re: Script Libraries
  • Index(es):
    • Date
    • Thread