Mailing List Archive


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

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



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

 > > 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.

And indeed that's a PITA.  But basically everything since Perl has
decided that escaped punctuation is a literal.  And grep is really the
only multi-modal application that matters (or ever did).  Personally I
think that deprecation of "fgrep" and "egrep" was a mistake.

 > > 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.

In fact, it's arguable that much progress in mathematics is due to
recognizing that two notations that look similar are actually similar,
and then finding out *why* they are similar and *how* they differ.  I
suppose sometimes it goes the other way (one notation is used for two
concepts that are really different, and a notation is invented to
distinguish the two), but I can't think of examples offhand.

 > > For this reason ISO 80001 states that...

I think you mean ISO 80000, perhaps Part 1?

 > 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.

Definitely.  As far as I can tell, mathematical notation usually
standardizes on that of the most popular textbook with an adequate
notation, about 100 years after research in the field stops<wink/>.
This doesn't cause problems for mathematicians at all.  And I've
never seen a preface that says "This book conforms to ISO 80000 in
notation."

 > > 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.

Well, to be fair he did write "if ... it requires cross reference
checks ...".  Nevertheless, I agree with you that in programming,
readability is mostly a function of style, not ambiguity or redundancy
(elif vs elsif vs else if, I'm looking at you!).  Even for the leading
example of basic vs. extended regular expressions, I just don't find
myself having trouble requiring cross-referencing with any language's
notation in the context of programming in that language.  (I might
have trouble switching from PCRE to basic RE if I didn't program in
Emacs Lisp a lot.  But the rule for extended RE and PCRE -- that
escaped punctuation are literals, not operators, is very easy.)

And in the theorem-proving side of mathematics, the cross reference
checks are needed anyway -- definitions and postulates are generally
presented immediately before use and their content explicitly stated
in proofs.  So, the analogy of programming to mathematics is bogus,
except for pure computation.  One could even argue that programming
languages are the solution to ambiguity and redundancy in computation
-- except for the fact that there are so many different languages!



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links