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

Re: [Scheme-reports] Standard Feature Identifiers are too low-level

Marc Feeley scripsit:

> The more troublesome endianness aspect is that the ARM allows
> switching the endianness at run time (by flipping a flag in the CPU's
> status register).  Moreover the ARM stores code in little-endian
> format and data in either little-endian or big-endian format (IIRC).
> So what do the little-endian and big-endian features refer to, code or
> data?  It is a mess that simple cond-expand feature identifiers cannot
> address well.

I agree it's a mess.  Surely data would be the thing that required
testing if anything did, however.

> In that case, why not defer the specification of these feature
> identifiers to R7RS-large, if and when they are actually needed?  I
> dislike standardizing things that have not been tested and whose
> usefulness hasn't been demonstrated.

Well, as I say, the ticket has been filed.

> Regarding bytevectors and endianness, Gambit avoids the endianness
> issue by separating the different uniform vector types (e.g. you
> can't treat a u16vector as a u8vector).  I'd be interested to see
> performance figures for your bytevector library proposal and how much
> performance is gained by having access to the endianness through
> a cond-expand, rather than just testing it at run time (i.e. (= 0
> (u8vector-ref '#u16(1) 0))).

Surely anything that avoids run-time tests (other than the unavoidable
argument domain test) can only be a performance win.

In any case, cond-expand is not required to make use of my proposal,
as all implementations must provide native, BE, and LE endianness.
The *implementation* of my proposal does depend on knowing the native
endianness, however, though this could be determined once and for all
at startup time and a hook (function pointer, at the C level) patched
to point to the correct routine for the running processor.

I note that it's trivial to layer SRFI 4 over my proposal, provided
that client code does not depend on the disjointness of the SRFI 4
vector types.  (My proposal does not currently include any lexical syntax.)

John Cowan    cowan@x    http://ccil.org/~cowan
If a traveler were informed that such a man [as Lord John Russell] was
leader of the House of Commons, he may well begin to comprehend how the
Egyptians worshiped an insect.  --Benjamin Disraeli

Scheme-reports mailing list