• 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: Operator vs. Command precedence
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Operator vs. Command precedence


  • Subject: Re: Operator vs. Command precedence
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 4 Jun 2009 23:33:17 -0400

On Thu, Jun 4, 2009 at 10:21 PM, Chris Page <email@hidden> wrote:
> The real issue here is that you expect “floor” to have the precedence of
> some operator, but AppleScript doesn’t know that it behaves as an operator,
> nor what its precedence would be if it were. If you’d like a means for
> commands to specify their precedence, please file an enhancement request at
> <http:bugreport.apple.com>.

Well, the *real* issue here is that I was expecting foo(...) to parse
as a function call, and therefore a single term, when of course that's
not the way AppleScript syntax works.  No feature request here -
specifying precedence for user-defined commands is mildly useful, but
less so when you can't override traditional (punctuational) operators,
and not way up there on my wish list.

I was just briefly confused, possibly due to my experience with
Certain Other Languages (<cough>Perl</cough>) which have a special
precedence rule that attaches parenthesis-enclosed arguments to the
preceding subroutine name for parsing purposes:

       If any list operator (print(), etc.) or any unary operator (chdir(),
       etc.)  is followed by a left parenthesis as the next token, the opera‐
       tor and arguments within parentheses are taken to be of highest prece‐
       dence, just like a normal function call.

(In Perl terminology, the definition of "operator" includes basically
anything that  can take arguments without requiring parentheses,
including specially-declared user-defined subroutines).

So PEBCAK, basically.  It's fine as-is;  (floor 1.5001) is nicely Lispy.

It Would Be Nice if integer coercion from real had some finer control;
 I didn't realize that floor() and friends were Satimagisms.  Might
turn that into an enhancement request..

--
Mark J. Reed <email@hidden>
 _______________________________________________
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: Operator vs. Command precedence
      • From: Chris Page <email@hidden>
References: 
 >Re: Same code gives different answers in 2 different scripts (From: Shane Stanley <email@hidden>)
 >Re: Same code gives different answers in 2 different scripts (From: "Mark J. Reed" <email@hidden>)
 >Re: Operator vs. Command precedence (From: Chris Page <email@hidden>)

  • Prev by Date: Re: Operator vs. Command precedence
  • Next by Date: Re: Minus-Hyphen, Numeric Negation and Subtraction
  • Previous by thread: Re: Operator vs. Command precedence
  • Next by thread: Re: Operator vs. Command precedence
  • Index(es):
    • Date
    • Thread