• 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: Jim Underwood <email@hidden>
  • Date: Mon, 20 Jun 2016 02:25:24 +0000
  • Thread-topic: Script Libraries

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


From: <applescript-users-bounces+jmichael=email@hidden> on behalf of Shane Stanley <email@hidden>
Date: Sun, Jun 19, 2016 at 7:01 PM
To: "ASUL (AppleScript)" <email@hidden>
Subject: Re: Script Libraries

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

 _______________________________________________
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: Shane Stanley <email@hidden>
References: 
 >Re: Script Libraries (From: Jim Underwood <email@hidden>)
 >Re: Script Libraries (From: Shane Stanley <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