Home | About | Partners | Contact Us

SourceForge Logo

Quick Links
Home
News
Status
Building XL
XL Mailing List

Understanding XL
Conceptual overview
XL examples
Inside XL
Concept Programming

In depth
Browse GIT
Bugs
SourceForge Info
Contact

Other projects
GNU Project
The Mozart Project

XLR: Extensible Language and Runtime

The art of turning ideas into code

Syntactic noise

Prev: Concept Programming Metrics

Up

Next: semantic noise

Syntactic noise is a difference between the syntax being used in the code and the concept it represents in the problem space. In other words, it is an indication that the code doesn't look the way a naive programmer might expect it. It is an important metric for Concept Programming. Since this is a form of noise, it is desirable to reduce it, but it is in general impossible to completely eliminate it. And also remember that noise is somewhat subjective, so what is noise to one person may be music to another.

Here are a few examples of common syntactic noise:

  • Statement delimiters such as ; in C, Pascal or Ada, or parentheses in Lisp, do not represent anything in the problem space. They address a concern in the problem space of compiler writers at the time the languages were designed ("how do you parse the input text and sync on errors?") rather than a concern for the users of those languages. XL attempts to eliminate as much of these extra characters as possible.

  • Having to use a text-based syntax is often a source of noise for a number of entities. Development tools like NeXT/Apple's Interface Builder or Visual Basic offer non-textual (graphical) descriptions of many GUI elements, which reduce syntactic noise.

  • Terseness in itself is good (that's why we normally write 1+2 in programs rather than add 1 and 2), but it really works well only for widely accepted notations. The APL language, for instance, was known to be very difficult to decipher because of its over-use of strange operators.

  • In C++, so-called angle brackets are used to delimit template parameters and arguments, as in vector<int>. This is a productive source of syntactic noise. It causes simple syntactic ambiguities because >> is also a C++ operator, so the text vector<vector<int>> doesn't parse right. You need to insert a space, as in vector<vector<int> >. There are ambiguities when invoking templates too, as in f<g&&h>(i), which can be either a set of two comparisons if f is, say, an integer variable, or an explicit template instantiation with g&&h as a template argument and i as a run-time argument if f is a template name.

See the concept programming analysis of existing languages for examples combining semantic noise and syntactic noise.

Syntactic noise complicates maintenance of programs, and makes the learning curve steeper. However, it is important to note that complicated syntactic rules may make it easier for compilers to detect and report errors.

Prev: Concept Programming Metrics

Up

Next: semantic noise


Copyright 2008 Christophe de Dinechin (Blog)
E-mail: XL Mailing List (polluted by spam, unfortunately)