comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus.rm.tsoh@maps.futureapps.de>
Subject: Re: SI Units - has Ada missed the boat?
Date: Wed, 18 Jul 2007 10:17:58 +0200
Date: 2007-07-18T10:14:10+02:00	[thread overview]
Message-ID: <469dcbd2$0$21009$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <1184742672.910297.54010@o11g2000prd.googlegroups.com>

kevin cline wrote:

> This is rather unwieldy since Java does not allow operator
> overloading.  Who wants to read code like:
> 
>    time_aloft = sqrt(height.times(2).divide(g))

I'd like to know why this programmer's expression of a formula
for use by a computer is inferior, assuming the typical alternative
would be[*]

     time_aloft = sqrt((2 * height) / g))

I see that if you have very few operators in a program,
the chance of a human misreading a possibly ambiguous operator is
fairly low, understanding rather than misunderstanding the formula
might be easy.
So there is some amount of correspondence between uses of {punctuation
characters and symbols} in physics text on the one side and uses of
{punctuation characters} in programming text on the other side.
E.g., "/" usually means division in either case, even when the
semantics do not match 100%.

But in general, will it help to mimic a specific math expression
in larger programs, using (sub-)domain specific symbols?[**]
When I have a package for motion operators and then another operators
package for unrelated uses (since this is about overloading, there
are at least two). I can make one group of operators visible locally.
But is the effect really superior enough in the long run to
warrant all kinds of symbol overloadings? Or is it just the
desire of programmers for some magic spells (possibly improving
productivity due to an increased fun factor)?

I like the idea of concise formulae in a program when the symbols
are well understood and/or stand out (including some Unicode symbols,
at last!)

Imagine having to switch programming languages every now and then.
"Wait, what does '!' stand for, uuh, yesterday I was using C++---no
it was Fortran 90, that was the day before yesterday. Now this is ML,
not APL, ehr, '!' means ..."


 -- Georg 

 [*] assuming that a physicist, being used to the mathematical
expression, will assume commutativity of "*", which might or might
not be a good idea.

 [**] Indeed, typesetting systems have made some texts suffer from what
is criticised as symbolitis, making them more difficult to understand.



  reply	other threads:[~2007-07-18  8:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-08 15:13 SI Units - has Ada missed the boat? Martin
2007-07-10  5:54 ` ME
2007-07-18  7:11 ` kevin cline
2007-07-18  8:17   ` Georg Bauhaus [this message]
2007-07-23  5:29     ` kevin cline
2007-07-23 18:43       ` Georg Bauhaus
2007-07-24  9:59         ` Colin Paul Gloster
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox