Home About Subscribe Search Member Area

Humanist Discussion Group


< Back to Volume 34

Humanist Archives: May 19, 2020, 8:48 a.m. Humanist 34.31 - punctuation in the assignment statement

                  Humanist Discussion Group, Vol. 34, No. 31.
            Department of Digital Humanities, King's College London
                   Hosted by King's Digital Lab
                       www.dhhumanist.org
                Submit to: humanist@dhhumanist.org


    [1]    From: Henry Schaffer 
           Subject: Re: [Humanist] 34.27: punctuation in the assignment statement (175)

    [2]    From: Andrew Prescott 
           Subject: Colons (27)

    [3]    From: Gabriel Egan 
           Subject: Re: [Humanist] 34.27: punctuation in the assignment statement (33)

    [4]    From: Robert Delius Royar 
           Subject: Re: [Humanist] 34.27: punctuation in the assignment statement (15)


--[1]------------------------------------------------------------------------
        Date: 2020-05-18 16:30:45+00:00
        From: Henry Schaffer 
        Subject: Re: [Humanist] 34.27: punctuation in the assignment statement

Willard,

  I'm going to approach this not as a linguist (which I'm not) but as a
computer programmer (which, at times, I am and have been.) There is an
absolute requirement in programming that the programmer knows how the
computer will interpret instructions and then must write the code to
conform exactly to those requirements.

In assembly language coding, one can use symbolic instructions or machine
language instructions. In machine language something as basic as the
instruction to load the contents of location 100 into register A might look
like this 011 144  (actually, in the computer this would be 00001001 01100100 
but the keyboard probably makes the change), but to make life easier for the 
programmer, there can be a program which will input a human readable form 
and transform it into the digital form actually used by the computer (an 
"assembler") - so that might look like LD A 100 (the "100" is in decimal 
format, but the computer uses binary and the "144" is the octal 
representation as used in the early days.)

My point is that the instructions to the computer must be unambiguous, and
that secondarily we can consider easing the effort of the coder and also
decreasing the chance of mistakes - e.g. using decimal notation, even if
the computer uses binary, can let the programmer work faster and make fewer
errors.

The state of the technology available at the time also has an effect. E.g.
why not write  A <- B + C instead of A = B + C ? One very good reason is
that there was no <- character available in the ASCII set of characters used
at that time. So instead = was used and it was *defined* in FORTRAN, Basic
and elsewhere as put the value of what is on the right into the variable
whose name is on the left. It's not at all a question of what the symbol
means in a different context such as math, it's the definition of what it
means in this context.

The meaning isn't a matter of opinion - it was the definition. That's the
way your instructions would be transformed into the computer binary
instructions, and if you didn't like it, too bad, you just couldn't program
in those languages. If someone wanted to write a new language which used
the <- or :=, then that would be the definition for that language. Similarly
for choosing whether the movement should be from the right to the variable
on the left, or vice versa.

Other arbitrary definitions were added - such as the order of parsing the
elements of the expression when this wasn't unambiguously specified by the
use of parentheses. e.g. does A * B^3 mean (A * B)^3 or A * (B^3)?  These
are all arbitrary, but are needed to let us communicate and so even in
elementary education the students learn (arbitrary) rules such as PEMDAS
(or, Willard, BEDMAS? :-).

All of the above is to make the point that there are conventions in
symbolism, and that, even if one doesn't like them, they are needed for
communication. The alternative is to make up a new (computer) language
which seems better, use that and convince others to adopt it. So I'll claim
that this has nothing at all to do with mathematics,  it is purely a matter
of arbitrary assignment of interpretation of symbols.

--henry

P.S. Another arbitrary rule is how to designate the end of a statement in a
higher level computer language. Three different conventions come to mind:
1) demarcation via a newline character, 2) demarcation via designated
character, e.g. ";" 3) demarcation via a newline, except if the next line
starts with a signal such as a punched hole in column 6.

On Mon, May 18, 2020 at 6:26 AM Humanist  wrote:

>                   Humanist Discussion Group, Vol. 34, No. 27.
>             Department of Digital Humanities, King's College London
>                    Hosted by King's Digital Lab
>                        www.dhhumanist.org
>                 Submit to: humanist@dhhumanist.org
>
>
>
>
>         Date: 2020-05-18 10:19:33+00:00
>         From: Willard McCarty 
>         Subject: punctuation in the assignment statement
>
> Here follows a rather lengthy prelude to a question in the history and
> psychology of programming. Help, please!
>
> Anyone who has read David Crystal's Making a Point: The Pernickety Story
> of English Punctuation (2015) will know that many have attempted to fix
> the semantics of punctuation in English but none succeeded, though
> Lindley Murray's English Grammar (1795) established a long-lasting
> convention that has survived well beyond the Oxford English Dictionary.
> My specific interest in punctuation is in the colon as it is used in
> programming when combined with the equals-sign. This occurs in what are
> known as assignment statements, e.g. in ALGOL and other languages
> influenced by it, thus:
>
> X := Y + Z
>
> In FORTRAN, as you may know, the equivalent is written (disturbingly to
> some mathematicians) thus:
>
> X = Y + Z
>
> This looks like algebra but isn't truly algebraic because it is an
> imperative statement ('set the value of X equal to the sum of Y and Z')
> rather than a declarative one ('the value of X is equal to the sum of Y
> and Z'), as in algebra. Many have objected for very good reasons, mostly
> on the grounds that students who come to programming with a background
> in maths tend to become confused.
>
> Now for the historical bit. Within the first decade of digital computing
> it became obvious that programmers would fold under the burden of
> writing machine instructions. As Grace Hopper remarked, machines were
> getting faster but programmers weren't. One of the differences in how to
> design a standard high(er)-level programming language that would make
> programming easier and quicker centred on the assignment statement,
> specifically how to write it. Alan Perlis roughly sums up the story:
>
>  > …Americans, following the FORTRAN approach, had the variable being
>  > assigned to on the left. The Europeans had it on the right. The
>  > Americans used an equals sign for the assignment, thus hiding the
>  > fact that there is a direction to the assignment; the Europeans used
>  > a directed arrow pointing to the right. When ALGOL 58 came out,
>  > neither equals nor directed arrow was used, but a colon-equal and it
>  > pointed to the left. (Wexelblat, History of Programming Languages, 1981:
>  > 142)
>
> Hence X := Y + Z!
>
> My question is this: why the colon? What was this mark of punctuation
> meant to suggest, or better, what would it have suggested and what does
> it continue to suggest? The OED note on the colon as a mark of
> punctuation (rather than as a part of our anatomy) is a succinct
> statement of the conventional sense that would have been nigh universal
> in English usage in the mid 20th Century:
>
>  > Its best defined use is to separate clauses which are grammatically
>  > independent and discontinuous, but between which there is an
>  > apposition or similar relation of sense. Thus it may introduce an
>  > antithetic statement, an illustration, extract, etc.
>
> I suppose, then, that in the ALGOL lingo the colon functions as an
> appositional qualifier, a cognitive pause and a warning as to how the
> equals-sign is to be read. (I am getting here into the psychology of
> programming, into how on some level we read and write ALGOL and similar
> languages.) So I translate "X is to be MADE equal to the sum of Y and
> Z". Or, we might say, "Warning: this is NOT an algebraic statement!" Or,
> better, I think: "Here we must stretch our understanding of mathematics
> to include something new."
>
> Is there any supporting historical evidence for my supposition?
>
> Many thanks for any pointers.
>
> Yours,
> WM
> -----
> P.S. Perlis' reference to "the Europeans" should have been more specific
> to give credit to Heinz Rutishauser, who in his foundational paper
> Automatische Rechenplanfertigung bei programmgesteuerten Rechenmaschinen
> (1951, published 1952) introduced what he called the "Ergibtzeichen",
> which looks to me like a right-pointing arrow superimposed on an
> equal-sign. Clarity! If only...
> For the source materials see:
>
>
>
http://www.softwarepreservation.org/projects/ALGOL/standards/?searchterm=Proceed
> ings%20of
> 
>
>
> --
> Willard McCarty (www.mccarty.org.uk/),
> Professor emeritus, Department of Digital Humanities, King's College
> London; Editor, Interdisciplinary Science Reviews
> (www.tandfonline.com/loi/yisr20) and Humanist (www.dhhumanist.org)


--[2]------------------------------------------------------------------------
        Date: 2020-05-18 15:52:57+00:00
        From: Andrew Prescott 
        Subject: Colons

Dear Willard,

I passed on your query to my colleague Jeremy Smith, who is as you know a
historian of punctuation. He was fascinated to hear about the role of the comma
in computer languages, and offered these two pieces of background on the history
of the colon:

"I loved the reference to pausing, an inherited element from the elocutionist
tradition, balancing the grammatical and rhetorical.

According to The Complete Letter Writer (1756 edition, p.15): A Colon, marked
thus (:) is used when the Sense is perfect, but the Sentence not ended; as, If
the Enemy advances, I command you to give Battle: if not, march strait to the
City. It is generally used before a comparative Conjunction in a Similitude; and
also if the Period runs out pretty long.

I guess you have this one -- but just in case the book isn't to hand -- Malcolm
Parkes calls the mark the double punctus: 'The symbol used for the colon mark (a
development from the punctus elevatus) but also used by the humanist
scribes to indicate the pause after a comma' (1992: 304)".

Best wishes

Andrew




--[3]------------------------------------------------------------------------
        Date: 2020-05-18 15:45:47+00:00
        From: Gabriel Egan 
        Subject: Re: [Humanist] 34.27: punctuation in the assignment statement

Dear Willard

Two observations on the work a colon is doing in
assignment statements such as:

   X := Y + Z

First, in his classic _A Dictionary of Modern English Usage_
H. W. Fowler described the purpose of the colon as: "delivering
the goods that have been invoiced in the preceding words"
(page 569 of the 1995 Wordsworth reprint). That seems to
me to cover the programming sense of "consists of".

Secondly, a common piece of British punctuation when I was
learning to write 50 years ago was the colon followed by
the hyphen, as in ":-", used much as a colon is used now
to introduce a list. This combination is now widely deprecated
I believe. I wonder if the inventors of Algol were adapting
this punctuation in coming up with ":=".

Regards

Gabriel Egan

________________________________________________________________________
Professor Gabriel Egan, De Montfort University. www.gabrielegan.com
Director of the Centre for Textual Studies http://cts.dmu.ac.uk
National Teaching Fellow http://www.heacademy.ac.uk/ntfs
Gen. Ed. New Oxford Shakespeare http://www.oxfordpresents.com/ms/nos





--[4]------------------------------------------------------------------------
        Date: 2020-05-18 12:47:17+00:00
        From: Robert Delius Royar 
        Subject: Re: [Humanist] 34.27: punctuation in the assignment statement

Could the choice of colon be influenced mainly be the keypunch device used
to input the code, the ease of typing characters, and the existing
conventions regarding arithmetic operators represented on the keyboard? See
page 229 of The History of Programming Languages edited by Richard L.
Wexelblat, which I located with the Google search, keypunch machine "ALGOL
58"

I believe the simpler interpretation is that the available character set
influenced the choice more than did the designer's sense of the hermeneutic
implicature of the ':'.

--
               Robert Delius Royar
 Caught in the net since 1985



_______________________________________________
Unsubscribe at: http://dhhumanist.org/Restricted
List posts to: humanist@dhhumanist.org
List info and archives at at: http://dhhumanist.org
Listmember interface at: http://dhhumanist.org/Restricted/
Subscribe at: http://dhhumanist.org/membership_form.php


Editor: Willard McCarty (King's College London, U.K.; Western Sydney University, Australia)
Software designer: Malgosia Askanas (Mind-Crafts)

This site is maintained under a service level agreement by King's Digital Lab.