Re: #\a octothorpe syntax vs SRFI 10 bear 31 Dec 2004 00:18 UTC


On Thu, 30 Dec 2004, Aubrey Jaffer wrote:

>In the updated srfi-58.html I sent to the editor I have eliminated the
>#Axxx syntax.  The rank digit(s) will be required.

My own preference would be something like [3 instead of #A3(
making the bracket-number combination (without a separating space)
a token that means "start an array of this numerical order."

Scheme makes parentheses separating characters, but brackets,
officially, are not parentheses.  I think openbracket immediately
followed by a number is a much nicer (more succinct) way to
indicate array rank.

You could extend it for Uniform arrays, if you wanted:  [3u8
would mean "start a rank 3 array of 8-bit unsigned integers."
it's two fewer characters every time an array is used, and
the symbols are visually simpler.  I think that's important,
actually.

> | >  | So, for example, the two-by-two array of unsigned 16-bit integers from
> | >  | the document might be written as #,(ARRAY 2 u16 (0 1) (2 3)).

or as [2u16 [ 0 1][ 2 3]] .  This treats openbrace as a non-delimiter
character (allowing rank, etc, prefixes to be appended) and close
brace as a delimiter.

> | >  | General object arrays' types would be OBJECT (so #(FOO 1 #T ())
> | >  | could also be written #,(ARRAY OBJECT FOO 1 #T ()))

Or as [ FOO 1 #T '() ]

> | >  and character
> | >  | arrays' types would be CHAR (so "foo" could alternatively be
> | >  | written #,(ARRAY CHAR #\f #\o #\o)).

I don't think that "string" as a misspelling of "character array"
is consistent with the modern universe of character sets and encodings.
I think that

[c #\f #\o #\o ] should be a different entity than "foo."

>English doesn't much help remember Scheme exponent markers:
>
>  The letters `s', `f', `d', and `l' specify the use of SHORT, SINGLE,
>  DOUBLE, and LONG precision, respectively.
>
>I don't usually think of a DOUBLE as shorter than a LONG.  And where
>did `f' for SINGLE come from?  Maybe it is a C-ism.  In any case, it
>is one of five characters (with 'e') rather than one of five longer
>sequences to remember.

Actually, scheme exponent markers other than default-precision 'e'
are 's' 'f' 'd' and 'l', for  'short', 'float', 'double', and 'long',
which only makes sense if you are a C programmer.  The idea with C
was that these names would be distributed among the hardware float
types available, such that they are a nondecreasing sequence in
precision, although some precisions may be known by more than one
name.  Unfortunately, rather than actually carry through with the
plan, most C compilers now treat 'double' and 'long' as identical
precisions, while introducing new tokens, 'long long' or 'extended'
to denote even bigger precisions.

Personally, I think this is a wart in scheme numeric syntax; these
are properly about exactness and belong with the exactness prefix,
not in the exponent marker.

				Bear