0

Related to:

Does the functionality of Grouping operator () in JavaScript differ from Haskell or other programming languages?

Does the Hack-style pipe operator |> take precedence over grouping operator ( ) in order of operations in JavaScript?

At least, for the latter issue, unfortunately, we still haven't reached a conclusion, therefore, I'd like to ask more generally;

If a specific syntactic sugar is created in a language, is it possible to take precedence over grouping operator ( ) in order of operations?

In the more specific issue, there is a JavaScript TC39 proposal/ hack-pipeline-operator, and the spec claims:

enter image description here

and for the functionality,

https://stackoverflow.com/a/69429001/10638454

lhs |> rhs

is syntactic sugar for

(% => rhs)(lhs)
KenSmooth
  • 275
  • 1
  • 10
  • Only if the operands in the "syntactic sugar" take precedence over the grouping operator. Note that "syntactic sugar" is usually an abstraction for the general case and does not necessarily have the same semantics in detail. – Jonas Wilms Oct 07 '21 at 07:25
  • I don't believe we need another Q&A on this topic, please follow up with Bergi (who's really an expert in that regard). I've close voted this and voted to reopen your original question. – Jonas Wilms Oct 07 '21 at 07:26
  • 2
    ??? Is this question about how Javascript operates today, or about how to design a new language? If the former, then 1. why can't you just type something into your favorite Javascript implementation to learn what you care about and 2. why would you think Haskell folks know more about it than Javascript folks? If the latter, then, well, why is this even a question? You can make your language do whatever the hell you want, including, yes, having some operator that interacts with parentheses in some unusual way. – Daniel Wagner Oct 07 '21 at 09:32
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackoverflow.com/rooms/237919/discussion-on-question-by-kensmooth-if-a-specific-syntactic-sugar-created-in-a-l). – deceze Oct 07 '21 at 11:23
  • Removing the Haskell tag; tags are supposed to describe the question, not attract attention from a group you think (correctly or not) can help answer the question. – chepner Oct 07 '21 at 12:00
  • In Haskell, user can define operators, and they care precedence, therefore related topic. – KenSmooth Oct 07 '21 at 12:23

0 Answers0