• 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: Grammar Police in OS X 10.11
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Grammar Police in OS X 10.11


  • Subject: Re: Grammar Police in OS X 10.11
  • From: Phil Stokes <email@hidden>
  • Date: Fri, 15 Jan 2016 20:15:43 +0700

On 15 Jan 2016, at 19:03, Chris Page <email@hidden> wrote:


On Jan 14, 2016, at 7:26 AM, Phil Stokes <email@hidden> wrote:

On the bright side, it means someone’s been messing about with the AppleScript compiler, which I’d presumed had  been hermetically sealed and buried in a Carbonised tomb adorned with Pascalian runes some 2 decades past. 

Read the AppleScript release notes for the past several OS releases:

https://developer.apple.com/library/mac/releasenotes/AppleScript/RN-AppleScript/Introduction/Introduction.html


Well, it was sort of tongue-in-cheek, Chris, and I’m not here to disparage your work, but even so after 20+ years we still can’t get anything better than this:

tell app "Xcode
set x to 1
set y to 2
end

—> Syntax Error
Expected “”” but found end of script


Couldn't we even get the cursor or highlight on the offending line? 

Here’s the same error (missing end quote on line 1) on a previously compiled script, but compare what we get now from the compiler when we try to compile or run again after making the error:

tell application "Xcode
tell source document 1
set {a, b} to selected character range
set c to contents
set d to text a thru b of c
--my findAll(d, "== NS") --returns the offset of each occurrence
my replaceString(d, "=/", "= / ") -- replace every occurence of $1 with $2 in $0



--when you're done changing, you need to copy back to source doc
set formattedText to c
set contents to formattedText
end tell
end tell

Syntax Error
Expected _expression_ but found “=”.
(highlights the second ‘=‘ character on Line 6 - yeah, you’ll have to count cos there’s no line numbers in ASE either… :p)

I understand why it does that (it sees the second quote mark on Line 6 as the end of a string, and then see’s an error after that), but that doesn’t change the fact that it’s not just unhelpful, it’s thoroughly misleading. 

The compiler (like most text editors) could at least balance quote marks. It could also easily be written to expect a quote mark before a new line in any line with ‘tell application “…’ since no app name is ever going to contain a new line.

Error reporting in the AS compiler is like a blunt hammer, and while experience ameliorates the problem for the seasoned hand, I expect for most people coming to AS fresh, it’s the biggest stumbling block. I know when I first started out just getting a script to compile was a major triumph. The compiler could do a great deal more here to ease the learning curve.

Run-time error reporting could also do with a serious makeover, but I’d be happy just to see some improvements at compile time (mutter, mutter and mutter line numbers, mutter, breakpoints, variable introspection, mutter mutter...).


Best


P



 
 _______________________________________________
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: Grammar Police in OS X 10.11
      • From: Chris Page <email@hidden>
References: 
 >Re: Grammar Police in OS X 10.11 (From: Nigel Garvey <email@hidden>)
 >Re: Grammar Police in OS X 10.11 (From: Phil Stokes <email@hidden>)
 >Re: Grammar Police in OS X 10.11 (From: Chris Page <email@hidden>)

  • Prev by Date: Re: Why Doesn't This Script.app Quit?
  • Next by Date: Re: Grammar Police in OS X 10.11
  • Previous by thread: Re: Grammar Police in OS X 10.11
  • Next by thread: Re: Grammar Police in OS X 10.11
  • Index(es):
    • Date
    • Thread