Requirements Specification and Development Principles for Programming Languages

Analysis Requirements & Principles architecture:
Paradigms
substance:
Abstractions
structure:
Domains
building blocks: Features surface:
Syntactics
Defining PLs Language
List
foundational safety flexibilized

  1. Irreducible Programming Language Requirements
  2. General Advice
  3. Orthogonality and Expressiveness
  4. Evaluating Programming Languages
  5. Specific Rules
  6. Development Methods for Programming Languages

 
If you know further references, please don't hesitate to tell me (Ulf Schünemann), likewise if you have any suggestions.

In this section a lot of requirements, adivice, rules, principles, properties, and the like will be presented. An overview:
Irreducible
Requirements
  • Practicality: adequacy and translatability
  • Learnability
  • Attractiveness
  • Productivity:
    - Correctness: error prevention & detection
    - Reuseability: portability, factorization, internationalization, module libraries, ...
    - Code Management: separability, ...
  • Standards
  • General
    Advice
  • Good for Throwaway Programs
  • Programming Languages Are for People
    & The Human Thought Property
  • Design for Yourself and Your Friends
  • Give the Programmer as Much Control as Possible
  • Aim for Brevity
  • Admit What Hacking Is
  • Principle of Frequency
  • Principle of Locality
  • Principle of Lexical Coherence
  • Principle of Distinct Representation
  • Principle of Too Much Flexibility
  • Principle of Semantic Power
  • Simplicity: uniformity/regularity, generality (involution), familiarity, brevity
  • Consistentcy
  • Redundancy
  • Orthogonality:
  • Semantic independence
  • Compositional semantics
  • Cleanly integrated features
  • Composability of features
  • Avoid special purpose features
  • Performance independence
  • Understatement independence
  • Specific
    Rules
  • The Abstraction Principle
  • The Parameterization Principle
  • The Correspondence Principle
  • The Qualification Principle
  •  


    Irreducible Programming Language Requirements

    Specifications for programming languages are like specifications for any other product, e.g., software: «A specification describes the behaviour of the machine at its interface with the environment, where the effects and benefits of the machine will be felt and assessed. ... [S]een from the environment, it is a restricted kind of requirement.» «All phenomena required to be constrained are directly machine-controlled. ... the machine can execute, or refrain from executing, the actions directly.» [SfR]
    So the specification for a language are the properties defined (controlled) by the a language (together with standard library, compiler and runtime environment) that are required to achieve satisfaction of the requirements.
    (Requirements for ``software process languages'' are specified in the SLANG paper.)
    Examples of requirements (see also: [Louden]):

    General Advice

    Some sets of general principles of programming language development and properties of programming languages to consider (that cannot always be directly related to certain requirements).

    Some requirements/adivce conflicts:


    By Paul Graham:
    From [
    TAPL]:
    Other pieces of advice:

    Orthogonality and Expressiveness

    The vision of orthogonality is that there is a set of mutally independent features which span the entire language design space.

    Orthogonality

    «Basic features should be separately understandable and free from unexpected interaction. An example in which this principle is violated can be found in Pascal, where val and var parameters combine the type of use of parameters (i.e., input or output) with the parameter-passing mechanism (i.e., call-by.-value or call-by-reference)» [Stansifer].
    «Orthogonality is a desirable property. The facilities that are there should be highly independent. For example, if there are features for sequence control, then there should not be additional set of sequence controlling features down inside expressions.» [PLD, 518]

    Schmidt's definition of orthogonal [STPL, 155f]:
    «A new construction is orthogonal to a programming language if»

    1. Semantic independence: «The semantics of the original constructs in the language remain unchanged by the addition of the new construction.»
    2. Compositional semantics: « If the new construction uses component phrases from the original language, then the semantics of the construction is uniformly defined with respect to the compenent phrases--there are no ``special cases.'' »
    «Abstraction and paramterization are perhaps the two most important orthogonal extensions [of the core language]» [STPL, 96]

    Stroustrup's [WIOOP] guideline is essentially an explanation of five aspects of orthogonality (continued from):

    1. Cleanly integrated features: «All features must be cleanly and elegantly integrated into the language.»
      This reminds somehow of Schmidt's compositional semantics.
    2. Composability of features: «It must be possible to use features in combination to achieve solutions that would otherwise have required extra separate features.»
    3. Avoid special purpose features: «There should be as few spurious and "special purpose" features as possible.»
    4. Performance independence: «A feature should be such that its implementation does not impose significant overheads on programs that do not require it.»
    5. Understatement independence: «A user need only know about the subset of the language explicitly used to write the program.»
      This is about the same as Schmidt's semantic independence, just more symmetrical: also ``new'' features should not have their semantics influenced by ``old'' features.

    Expressiveness (Expressive Power)

    «All languages are equally powerful in the sense of being Turing equivalent, but that's not the sense of the word programmers care about. (No one wants to program a Turing machine.) The kind of power programmers care about may not be formally definable, but one way to explain it would be to say that it refers to features you could only get in the less powerful language by writing an interpreter for the more powerful language in it. If language A has an operator for removing spaces from strings and language B doesn't, that probably doesn't make A more powerful, because you can probably write a subroutine to do it in B. But if A supports, say, recursion, and B doesn't, that's not likely to be something you can fix by writing library functions.» [footnote in
    BTA]

    [EPL] gives a theoretical framework for comparing languages by defining when a language features is macro-expressible and when it is expressible in another language (some results see below). Macro-expressible is stronger than expressible. If a language L can macro-express an additional feature F, then F is `syntactic sugar' to L and can be eliminated.

    ``In the long run, we hope that some theory of language expressiveness develops into a formal theory of the programming language design space, and that such a theory can help a programmer in selecting the right set of constructs for solving a problem.'' [EPL, 41]
    The opposite of expressible would be orthogonal: If a language L cannot express an additional feature F, then F is orthogonal to the features of L.

    For example, the programming language could provide for the direct expression of higher-level design abstractions. (But these abstractions could also be supported by frameworks, etc). This is discussed in The Programming Design/Implementation Boundary.


    Discussion of Orthogonality and Expressiveness


    Evaluating Programming Languages

    How to Evaluate

    Interestingly, since starting the PLD site, I cannot remember having found criteria directly for PLs, but only criteria for modeling and specification methods:

    [STDA] Barbara H Liskov, Stephen N Zilles: Specification Techniques for Data Abstractions; Trans. SE 1(1); 1975.
    Criteria for evaluating specification methods:

    1. Formality: "a notation that is mathematically sound".
    2. Constructability: "It should be possible to construct specifications without undue difficulty"
    3. Comprehensibility: "A person trained in the notation ... should be able ... with a minimum of difficulty, [to] reconstruct the concept which the specification is intended to describe"
    4. Minimality: "The properties which are of interest must be described ... in a way which adds as little extraneous information as possible"
    5. Wide Range of Applicability: "[T]he larger the class of concepts which may be easily described by a technique, the mrore useful the technique"
    6. Extensibility: "[A] minimal change in a concept results in a similar small change in its specification"

    [ORM1] Terry Halpin: UML Data Models from an ORM Perspective: Part One; Conceptual Modelling 1; April 1998.
    gives criteria for evaluating conceptual modeling methods:

  • Expressibility,
  • Clarity,
  • Semantic stability,
  • Semantic relevance,
  • Validation mechanisms,
  • Abstraction mechanisms,
  • Formal foundation.

    Examples of Evaluations & Judging Language Comparisons

    Non-judging comparisons between languages are discussed in
    PL comparison.

    The Subjectiveness of Language Comparisons

    The Blub Paradox [BTA]: «[T]o explain this point I'm going to use a hypothetical language called Blub. Blub falls right in the middle of the abtractness continuum. It is not the most powerful language, but it is more powerful than Cobol or machine language.
    And in fact, our hypothetical Blub programmer wouldn't use either of them. Of course he wouldn't program in machine language. That's what compilers are for. And as for Cobol, he doesn't know how anyone can get anything done with it. It doesn't even have x (Blub feature of your choice).
    As long as our hypothetical Blub programmer is looking down the power continuum, he knows he's looking down. Languages less powerful than Blub are obviously less powerful, because they're missing some feature he's used to. But when our hypothetical Blub programmer looks in the other direction, up the power continuum, he doesn't realize he's looking up. What he sees are merely weird languages. He probably considers them about equivalent in power to Blub, but with all this other hairy stuff thrown in as well. Blub is good enough for him, because he thinks in Blub.
    When we switch to the point of view of a programmer using any of the languages higher up the power continuum, however, we find that he in turn looks down upon Blub. How can you get anything done in Blub? It doesn't even have y.
    By induction, the only programmers in a position to see all the differences in power between the various languages are those who understand the most powerful one. (This is probably what Eric Raymond meant about Lisp making you a better programmer.) You can't trust the opinions of the others, because of the Blub paradox: they're satisfied with whatever language they happen to use, because it dictates the way they think about programs.»
    (The author remarks that expressivity is not a linear order, allowing for several ``most'' expressive languages)

    Specific Rules


    Development Methods for Programming Languages

    Worked out methods for developing a programming language seem not to exist. Some general guidelines for how to proceed:
    • Reuse: Take existing languages as a model, and reuse established constructs from them. «Use established constructs as much as possible.» [PLD, 517] (continued from). Existing PLs provide a wealth of constructs (discussed in PL features). «The notations of mathematics are a second, though certainly not indendendent source of concepts» [PLD, 523].
      (+) This development method helps achieving a high degree of familiarity.
      (-) But «it should be clear that past formalisms are not the source of new ideas. It is the undisciplined ramblings of human communication that are most likely to lead to real linguistic progress.» [PLD, 524] E.g. domain specific programming languages may include primitives taken from the application domain of their programs.
    • Experimental Prototyping: Concretize your ideas far enough to able to use it to write some programs, or (at least) one larger application.
      «Having decided not to do very much, and to copy most of it, the problem reduces to achieving the necessary features ... in a consistent manner. The simplest way to proceed is to write some programs. That is, let your new language invent itself naturally.» [PLD, 517]
      «You Need an Application to Drive the Design of a Language ... This may not be an absolute rule, but it seems like the best languages all evolved together with some application they were being used to write. C was written by people who needed it for systems programming. Lisp was developed partly to do symbolic differentiation, and McCarthy was so eager to get started that he was writing differentiation programs even in the first paper on Lisp, in 1960.
      It's especially good if your application solves some new problem. That will tend to drive your language to have new features that programmers need. I personally am interested in writing a language that will be good for writing server-based applications.» [5QLD]
    • Formalizing: «Then attempt to use the standard language definition tools (grammars) to specify the language concisely. ...
      One might suspect that the language would not improve by having to conform to a restrictive defining tool. But experience shows that it does. In some sense there is no art unless there is a restriction of the medium. In some perverse way, the human mind, in coping with restriction, produces its best results. And grammars, the very formalization of nested definition, are a rich medium.» [PLD, 518]
    • Iterative: «The restrictive form of definition will surely suggest changes in the language, then, in turn, in the sample programs. Iterate the process until both the program and the language description are elegant and understandable.» [PLD, 518]
    • Evolving A Programming Language: A given language is changed, yielding a language which can be seen as a new version of the old language or as a new language. E.g. Bjarne Stroustrup: The Design And Evolution of C++; Addison-Wesley, 1994.
      A common example are the standardized forms of programming languages which are (usually) developed (evolved) from an already existing languages. For example the evolution of Fortran 90 from Fortran 77 with the main antagonisms traditionalists vs. revisionists, featurists vs. generalists, and US-nationalists vs. internationalists.
      In "Language standards committees and revisions" Brain Meek talks about
      • Standardization as language evolution or as revolution?
      • Is language development for users or for implementors?
      • Should language evolution be backward-compatibile even for people who are not properly organised?
      His WG10 guideline classifies changes into
      • Change to semantics of well-defined feature.
      • Deletion of semantically well-defined feature.
      • Deletion of semantically ill-defined feature.
      • Clarification of semantically ill-defined feature.
      • Change or deletion of obsolescent feature.
      And it demands a rationale for each proposed change, an assessment of how widely the affected feature is used and of the difficulty of converting affected programs.

    [APL] A D Falkoff, K E Iverson: The design of APL; IBM Jounal of Research and Development; July 1973. Reprinted in: Programming Languages: A Grand Tour; 1987 -- ``guiding principles in [APL's] language design'' [Stansifer]: practicality; simplicity
    [EPL] Felleisen: On the Expressive Power of Programming Languages; SCP 91. dvi ps
    [Anatomy][TAPL] -- portability; frequency, locality, coherence, distinct, flexibility, power
    [5QLD] Paul Graham: Five Questions about Language Design; private notes 2001. -- throwaway programs, for people, for yourself, control, brevity, hacking
    [BTA] Paul Graham: Beating the Average.
    [Horn] James J Horning: What the compiler should tell the user; In: Compiler Construction (LNCS 21); 1974.
    [PLD] W M McKeeman: Programming Language Design; In: Compiler Construction (LNCS 21); 1974 -- [good] PL properties: adequacy, translatability; simplicity, orthogonality, human thought
    Stansifer>[Stansifer] -- criteria for evaluating PL design: translatability; factorization, orthogonality, simplicity, regularity, consistency

    Analysis Requirements & Principles Paradigms Abstractions Domains Features foundational safety flexible typing Syntactics Defining PLs Language List
    Ulf Schünemann 071297, 200901