Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Syntactic sugar
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Derivative terms == === Syntactic salt === The metaphor has been extended by coining the term ''syntactic salt'', which indicates a feature designed to make it harder to write bad code.<ref>{{cite web |url=http://www.catb.org/jargon/html/S/syntactic-salt.html |title=The Jargon File - syntactic salt |date=2003-06-12 |access-date=2018-03-19 |archive-url=https://web.archive.org/web/20030612232319/http://www.catb.org/jargon/html/S/syntactic-salt.html |archive-date=2003-06-12}}</ref> Specifically, syntactic salt is a hoop that programmers must jump through just to prove that they know what is going on, rather than to express a program action. In [[C Sharp (programming language)|C#]], when hiding an inherited class member, a compiler warning is issued unless the <code>new</code> keyword is used to specify that the hiding is intentional.<ref>{{cite web|url=http://msdn.microsoft.com/en-us/library/435f1dw2.aspx|title=new Modifier (C# Reference)|publisher=Microsoft|work=microsoft.com|access-date=3 August 2015}}</ref> To avoid potential bugs owing to the similarity of the [[switch statement]] syntax with that of C or C++, C# requires a <code>break</code> for each non-empty <code>case</code> label of a <code>switch</code> (unless <code>[[goto]]</code>, <code>return</code>, or <code>throw</code> is used) even though it does not allow implicit ''fall-through''.<ref>{{cite web |url=http://msdn.microsoft.com/en-us/library/vstudio/06tc147t.aspx |title=switch (C# Reference) |publisher=Microsoft |work=microsoft.com |access-date=3 August 2015}}</ref> (Using <code>goto</code> and specifying the subsequent label produces a C/C++-like ''fall-through''.) Syntactic salt may defeat its purpose by making the code unreadable and thus worsen its quality β in extreme cases, the essential part of the code may be shorter than the overhead introduced to satisfy language requirements. An alternative to syntactic salt is generating compiler warnings when there is high probability that the code is a result of a mistake β a practice common in modern C/C++ compilers. === Syntactic saccharin === Other extensions are ''syntactic [[saccharin]]'' and ''syntactic [[syrup]]'', meaning gratuitous syntax that does not make programming any easier.<ref>{{cite web|url=http://www.catb.org/jargon/html/S/syntactic-sugar.html|title=syntactic sugar|work=catb.org|access-date=3 August 2015}}</ref><ref>{{cite book|url=https://books.google.com/books?id=OfWiZNhyRGgC&q=syntactic+saccharin+example&pg=PA93|title=Mathematics of Program Construction|access-date=3 August 2015|isbn=9783540438571|last1=Boiten|first1=Eerke A.|last2=MΓΆller|first2=Bernhard|date=2002-06-26|publisher=Springer }}</ref><ref>{{cite book |last=Dean |first=Thomas |date=2004 |title=Talking with Computers: Explorations in the Science and Technology of Computing |url=https://archive.org/details/talkingwithcompu00dean |url-access=registration |publisher=Cambridge University Press |page=[https://archive.org/details/talkingwithcompu00dean/page/115 115] |isbn=9780521542043}}</ref><ref>{{cite conference |url=https://pdfs.semanticscholar.org/f396/bc99c7e444f70db69fb3f42e76e94e9d39a3.pdf |archive-url=https://web.archive.org/web/20170331115339/https://pdfs.semanticscholar.org/f396/bc99c7e444f70db69fb3f42e76e94e9d39a3.pdf |url-status=dead |archive-date=March 31, 2017 |chapter=Fine control of demand in Haskell |last1=Harrison |first1=William |last2=Sheard |first2=Tim |title=Mathematics of Program Construction |series=Lecture Notes in Computer Science |date=July 8β10, 2002 |volume=2386 |publisher=Springer Berlin Heidelberg |book-title=Mathematics of Program Construction: 6th International Conference, MPC 2002, Dagstuhl Castle, Germany, July 8β10, 2002. Proceedings |pages=93 |location=Dagstuhl Castle, Germany |doi=10.1007/3-540-45442-X_6 |isbn=978-3-540-43857-1 |s2cid=10059915 |conference=International Conference on Mathematics of Program Construction }}</ref> === Sugared types === Data types with core syntactic support are said to be "sugared types".<ref>{{cite thesis |type=PhD |last=Chugh |first=Ravi |date=2013 |title=Nested Refinement Types for JavaScript |publisher=UC San Diego}}</ref><ref>{{cite web|url=http://clang.llvm.org/doxygen/SemaCodeComplete_8cpp_source.html|title=C Language LLVM Documentation|work=clang.llvm.org|access-date=30 June 2020}}</ref><ref>{{cite web|url=https://medium.com/@slavapestov/the-secret-life-of-types-in-swift-ff83c3c000a5|title=The Secret Life of Types in Swift|work=medium.com/@slavapestov| date=14 July 2016 |access-date=30 June 2020}}</ref> Common examples include quote-delimited strings, curly braces for object and record types, and square brackets for arrays.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Syntactic sugar
(section)
Add topic