13

I was reading through Groovy in Action, Second Edition and on a footnote, I found the following text

Java pours "syntax vinegar" over such a construct to discourage programmers from using it.

What does the term syntax vinegar means here?

I have never heard of this term before and searched on DuckDuckGo and Google but couldn't find a meaning. But it's being used in multiple places. It would be great if someone can clarify the meaning of this term and how it applies in the context of programming languages. Hope this constitutes as a valid question. Couldn't find any other stackexchange site where I can ask this.

asked Aug 23, 2017 at 12:25
6
  • 17
    I'd assume it's the opposite of syntactic sugar Commented Aug 23, 2017 at 12:28
  • 2
    It means it's a not pleasant or easy to use syntax. It's the opposite of Syntatic Sugar. Edit: @VincentSavard, beat by 54 seconds. :) Commented Aug 23, 2017 at 12:29
  • 2
    see Discuss this ${blog} Commented Aug 23, 2017 at 12:35
  • 4
    The more usual term for the opposite of syntactic sugar is syntactic salt, but this almost certainly means the same. Commented Aug 23, 2017 at 12:40
  • 1
    Now I am just curious what exactly that were calling syntactic vinegar. Commented Sep 3, 2017 at 6:05

1 Answer 1

18

"Syntactic sugar" is a common term for syntactic constructs added to a language primarily to make certain constructs easier or more pleasant to use.

"Syntactic vinegar" is the opposite, making the syntax for invoking a questionable construct deliberately unpleasant, as a way of preventing programmers from using it unnecessarily, but without going so far as to make it actually invalid.

answered Aug 23, 2017 at 12:40
2
  • 13
    Note while "syntactic sugar" is a common, widely used term, "syntactic vinegar" is most probably an invention by the authors of that book. Commented Aug 24, 2017 at 14:07
  • Late comment to note that "syntactic vinegar" is a decades-old term. The earliest instance I've found is 1993 on the difficulty a new programmer would have in understanding a particular construction in Ada. This is a contrast to syntactic sugar in the sense of ease of reading (rather than writing) code. By 2003 Tantek Celik was using the phrase of XML namespaces and by 2006 David Heinemeier Hansson was using it of intentional constructions in Ruby on Rails to discourage behavior. Commented May 11, 2022 at 20:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.