Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Code Readability (was: perl?)



On 2016-08-19 23:42 +0900 (Fri), Benjamin Kowarsch wrote:

> Your favourite example is rather naive and you are making the mistake to
> equal brevity with readability and verbosity with diminished readability
> when in reality it could go either way.

Perhaps I didn't explain myself clearly, but I find it very amusing
that you interpreted my argument pretty much exactly backwards. My
point was, the mathematical notation we use today in junior high
school is *less* readable to al-Khwārizmī than his long-winded
version.

> With all this multi-modality, you can no longer tell for a given arbitrary
> context whether something like \( means a verbatim opening parenthesis or
> an opening group modifier symbol. It could be either depending on
> multi-modal settings and context.

Correct.

> Brevity or not, multi-modal notations are always bad.

Wrong.

These what you call "multi-modal" notations (I would prefer a term
more along the lines of "context-sensitive," are very frequently used
in mathematics. Mathematicians are renowned for making up new
notations--even from paper to paper--particular to whatever area they
happen to be discussing at the time.

> But now imagine that the ^2 could mean either squared or factorial or some
> other operation, depending on some definition on a different page at the
> end of the current chapter in which the formula is presented. Then imagine
> that more than half the symbols in the formula would be like that, that
> they too could have different meanings depending on something that is not
> actually part of the formula. And in a different book, it could mean
> something  different yet again. No two formulas in two different books
> would mean the same, even if they look the same.

Yes. That's an excellent description of the state of mathematical notation.

> If mathematical notation worked like that, we would still be in the
> medieval ages....

Yet it does work like that, and we're not.

> Luckily, mathematical notation is near free of multi-modality...

Anybody with a reasonable familiarity with maths can in a few moments
come up with a large number of counter-examples to disprove this.
Let's look at a few.

My favourite bugbear is this:

    { 1, 2 } ⊂ { 1, 2 }

True, or false? Well, if you're like me and think that the ⊆ symbol
should be useful for something, you'd say false, because { 1, 2 } is
not a proper subset of itself. Yet to take but one example, Joseph
Landin, in his classic work _An Introduction to Algebraic Structures_,
clearly defines ⊂ in the very first chapter not as proper subset but
just subset in the sense of can-also-be-equal set.

The dot operator is a huge one. What does x⋅y mean? Typically,
multiplication. But if you see A⋅B, that's much more likely a dot
product. You could argue that that's kinda similar to multiplication,
but that falls down when you look at f⋅g meaning function composition,
where for just a start you totally lose the commutativity implied by
the two earlier meanings.

And heck, when you're doing rings, the ⋅ becomes simply a second
arbitrary binary operation along with +. Though when you talk about
a semigroup, you're just as often deciding that the operation that
would be a + in a ring is now just called ⋅ instead.

As to what the heck the ⋅ is, well, it could be anything. I've seen
it used for handling configuration files and command line arguments.

Even something as simple as + takes on different meanings from the
standard elementary school arithmetic one depending on whether you're
working in boolean logic, modular arithmetic, or cryptography.

I've also, from courses I've taken, become quite used to pronouncing ≤
as 'covered by' (because everybody seems to use this binary relation
operator for posets and preorders as well as total orders). Looking up
notation on Wikipedia, I can see that <• might be considered the
"correct" way to do this, but I've never seen it used.

And ∂. Is that used for the partial derivative? Or the boundary of a
set? Or the degree of a polynomial? Answer: all of the above.

And for a classic mathematical notational mess, you can always check
out the various notations for exclusive-or:
    https://en.wikipedia.org/wiki/Exclusive_or#Alternative_symbols

> For this reason ISO 80001 states that...

Actually, many mathematicians don't really have much use for
international standards on quantities and units of measurement.
Particularly the mathematicians that don't even get involved with
numbers.

> A notation that has ambiguity as a "feature" is always less readable.

Just wrong. When you know the domain you're working in, trying to get
rid of all ambiguity is just extra unnecessary work for both the
writer and the reader. We no more need or want unique notation for
every different mathematical operation than we want unique names for
every individual in the world.


> If there is a chance to interpret
> symbols in different ways and it requires cross reference checks to obtain
> meaning, that diminishes readability, regardless of brevity.

Seems your mistake here is that you think that just because there are
multiple possible meanings when not given context, the meaning isn't
obvious in context.

cjs
-- 
Curt Sampson         <cjs@example.com>         +81 90 7737 2974

To iterate is human, to recurse divine.
    - L Peter Deutsch


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links