I am not sure that I know exactly what "a generic sort function" is.
As will come as no surprise to readers of my posts, I greatly prefer
PL/I to C; and in PL/I; generic is a compile-time facility.

The compiler sorts out SQRT(<signed halfword binary iinteger>) and
SQRT(<IEEE decimal float extended>), invoking the appropriate entry in
data-type-driven fashion.

Moreover, this facility is externalized, made available to PL/I
programmers too..  One can write, say,

declare cube_root generic(rt30000 when(signed binary fixed(7,0)),
  rt30001 when(real signed binary fixed(15,0),
  rt30002 when(real signed binary fixed(31,0),
  rt30003 when(real signed binary fixed(63,0),
  rt30004 when(complex binary fixed(7,0),
  rt30005 when(complex binary fixed(15,0),
  rt30006 when(complex binary fixed(31,0)) ;
  rt30007 when(complex binary fixed(63,0),
  . . .
  rt30015 when(complex decimal float(109)) ;

The notion that "the functional programming paradigm is becoming the
mainstream" seems to me to be an instance of wish being father to
thought, but exaggeration used to argue for change one judges
desirable is as old as Prometheus.

Let me also take this opportunity to recall that there are two sorts
of IEEE floating-point values, binary and decimal.  Binary is somewhat
faster and in my view more elegant; but, as Mike Cowlishaw has pointed
out, decimal is much more perspicuous for non-nerds.  zArchitecture
supports both, along with traditional System/360 hexadecimal
floating-point operations.

The generic question

What should the default be?

can be approached in two ways.  One can urge that what one judges best
be the default; or one can choose the minimally disruptive value, the
default that requires fewest changes in code already in use.

John Gilmore, Ashland, MA 01721 - USA

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to