Re: Why (or not) use single letter variable names?

From: Herman Rubin (hrubin_at_odds.stat.purdue.edu)
Date: 12/17/04


Date: 17 Dec 2004 09:42:54 -0500

In article <Pine.LNX.4.60-041.0412131844330.10757@unix45.andrew.cmu.edu>,
Arthur J. O'Dwyer <ajo@nospam.andrew.cmu.edu> wrote:

>On Mon, 13 Dec 2004, Herman Rubin wrote:

>> Phlip <phlip2005@gmail.com> wrote:
>>> Then, mathematicians name things in a common abstraction. "Tolerance"
>>> becomes "Epsilon", "Angle" becomes "Theta", etc.
>[...big snip...]
>> It could be done much more efficiently and produce better
>> code. Computer terminology seems to be deliberately
>> intended for confusion with most of mathematics terminology
>> beyond arithmetic and simple algebra; symbols with many
>> mathematical meanings are misused,

> Now, that's just silly. Most computer languages actually hew a lot
>closer to a "standard" meaning for symbols than mathematics does!

They don't, and systematic ambiguities are of sufficient
importance that I would like to see them even in assembler
language. If anyone is willing to cooperate, I can design
a semi-portable assembler language with overloaded operators
very quickly, and its adaptation for a particular machine
would also be easy.

But what I was complaining about was the usurpation by
languages such as C for mathematical symbols which already
have one, or several, meanings, all different from the
usage in the programming language. The "^" even has two
uses in computer science which differ from that of C, and
one of which I would even like to use, concatenation.
The "|" has many uses in mathematics, and the Backus
normal form used a longer line, which corresponds to the
|| in C. The ";" and "\" have many uses in mathematics.

>Consider the operator *, which in programming circles means
>"multiplication." Always has, always will, except in APL. But
>mathematics uses the star or asterisk to mean all kinds of different
>things (I've seen it used this semester alone as:
> F* : Skolemization of F
> x* : just another derivational suffix

Not "just another", and there are not enough available.

> x*y : just some random binary operator

Again, we have a shortage of available characters.

>And there are at least three competing conventions in mathematical
>notation for how to represent multiplication itself! (\times, \cdot,
>and nothing at all.)

All of which precede serious mathematics.

Someone has already pointed out several other meanings
for * in C. Why wasn't "@" used for indirection in C?
This is its common meaning! I CAN tell you; the editor
used by those designing some languages used this as a
line delete character. The symbol "&" is used both for
and and for address of. And the pointer usage is quite
atrocious.

> And don't get me started on parentheses! Even in C, they've only got
>three distinct meanings; and there exist some functional languages where
>they're only ever used for grouping. Contrast this to math, where (a,b)
>could mean probably half a dozen things.

I can think of three, and angle brackets are often used
for two of these. I can also think of ways to improve
the use of parentheses; one would be parentheses with
subscripts. And how many meanings do braces have in C?
These also disagree with mathematics.

>[...]
>> We need to get away from ASCII and have longer codes, which
>> can avoid writing "epsilon", but just have the one Greek
>> letter appear on the screen or the print, without "print"
>> spacing. Editing becomes otherwise a laborious task.

> Have you ever tried to enter Unicode text on a 101-key keyboard? It's
>a real pain.

So why restrict ourselves to the current badly designed
keyboard? I do not mean the placing of the characters,
but of the controls. For Unicode and other multi-alphabet
schemes, we should have a bank of shift keys. I am not
even convinced that operation keys should be adjacent to
character keys; it makes for errors.

 I love Unicode, but it's really not the future of
>programming. At best, it will allow your coworkers to comment their code
>in /portable/ Devanagari. (If you just want flashy Greek letters and text
>effects, why not learn CWEB? ;)
> I have no idea what you meant by "without 'print' spacing." Is it
>relevant?

It is; if there is fixed spacing, without "automatic"
formatting, the person composing at the keyboard will
find it much easier to make corrections. I currently
use TeX, and find it a pain, and would rather have a
bank of font selections available. This would also
enable at least a doubling of the characters available
for programming. Also, the topic here was not just
for programming, but for mathematics. When I want to
type out some notes, or an assignment, or a draft of
a paper, it is not just what appears to others, but
also what I have to type on the spot which matters.

>-Arthur

-- 
This address is for information only.  I do not claim that these views
are those of the Statistics Department or of Purdue University.
Herman Rubin, Department of Statistics, Purdue University
hrubin@stat.purdue.edu         Phone: (765)494-6054   FAX: (765)494-0558


Relevant Pages

  • Re: Why (or not) use single letter variable names?
    ... a semi-portable assembler language with overloaded operators ... have one, or several, meanings, all different from the ... The "|" has many uses in mathematics, ... we have a shortage of available characters. ...
    (sci.math)
  • Re: Variables
    ... > Indeed, this language is math. ... In mathematics, the word 'variable' is generally an undefined meta-term ... somewhere around 15 different meanings and shades thereof. ...
    (comp.lang.python)
  • Re: "Embedded" in the plane.
    ... >> Mathematical terminology is developed by the workers in the field, ... Mathematics should be available to everyone, ... whichever other language you wish] is in effect a different ... connection between the mathematical meaning and the ordinary meanings. ...
    (sci.math)
  • Re: All languages are equally fit
    ... not limited to mathematics at all? ...  Not all sequences of characters are "admissible", ... Just because something is not random does not mean it is a language. ... Mathematical notation is another. ...
    (sci.lang)
  • Re: regexp inside <> + typos in perldoc
    ... Globbing is a different language, and the all of the funny ... characters have different meanings. ...
    (comp.lang.perl.misc)