[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: #\a octothorpe syntax vs SRFI 10
| Date: Sun, 02 Jan 2005 15:00:14 -0800
| From: Per Bothner <per@xxxxxxxxxxx>
| Aubrey Jaffer wrote:
| > It cuteness is the only objection anyone makes, I'll take that as
| > consensus.
| OK, I'll be stronger: I think the integer-16 vs integer+16
| convention is ugly and violates the principle of "least surprise".
| If somebody sees "uinteger16" or "uint16" or "uinteger-16" most
| programmers can probably guess the meaning, or at least figure out
| where to look.
The Scheme reports appear to have been carefully crafted to be
self-contained with consistent nomenclature imported from mathematics
and computer science (floating-point exponent letters being the only
departure which comes to mind).
Scheme's name for 0, 1, 2, ... is "nonnegative integers". Using
abbreviations for terms which were never used in the reports demotes
Scheme to a secondary status: You can understand Scheme after you have
learned a *real* programming language.
| But I would have no idea that "integer+16" means "unsigned".
The tension between avoidance of abbreviations and keeping names short
produces encodings which are only partially descriptive. The choice
which must be made is which attributes to leave out.
Taylor Campbell proposed INTEGER16 and INTEGER16+ (or INTEGER-16 and
INTEGER-16+). Are those any better?
| > The words "signed" and "unsigned" do not occur in R4RS or R5RS;
| > neither does "int". Scheme owes nothing to C, except for looking so
| > fine in comparison.
| But "uinteger16" is still a reasonable and non-confusing abbreviation
| for "exact-16-bit-nonnegative-integer". But if you disagree, I'd still
| much prefer rather have "nonnegative-integer-16" over "integer+16".
I disagree because of the "u", which students learning their first
computer language will have no clue about. How about ninteger or
n-integer or nn-integer?
| > As discussed earlier, shorter names necessarily omit some of the
| > numerical attributes. The fully specified Scheme names would be:
| > inexact-IEEE-64-bit-floating-point-real-array
| > inexact-IEEE-32-bit-floating-point-real-array
| Right, but I'd still argue that "float-32" is a better abbreviated
| name than "real-32".
Then what word would you use to replace COMPLEX?
NUMBER, COMPLEX, REAL, RATIONAL, and INTEGER are the Scheme "numerical
types" (R5RS:6.2.1). SRFI-58's prefixes contain the numerical type; a
very strong argument would be required to justify replacing some but
not all of these numerical types.
Floating point and fixed point (or flonum and fixnum) are R5RS names
for "machine representations" (R5RS:6.2). The word "complement"
doesn't appear in R5RS, so "twos-complement" would be a poor
descriptor for the same reasons as "unsigned".