[r6rs-discuss] [Formal] Formal semantics should not contain complicating optimizations

From: John Cowan <cowan>
Date: Thu Mar 15 22:32:57 2007

Thomas Lord scripsit:

> You miss my point. We have overwhelming empirical evidence
> that in some situations it is useful for string-ref to be O(1) and
> in other situations for it to be O(n). If an implementation is
> to be Scheme, is its choice between those to be mandated by the
> report?

No, it is not to be mandated by the report, and it isn't.

BTW, it occurred to me that a representation-switching implementation
of strings can switch representations atomically provided the
pointer to the code units (8-bit, 16-bit, or 32-bit) contains
some tag bits indicating which one it is. When a string mutator
detects that it needs to convert the representation, it builds up
a new representation in freshly allocated memory, constructs the
specially tagged pointer to it, and atomically swaps in the new
pointer for the old. No locks.

-- 
Mark Twain on Cecil Rhodes:                    John Cowan
I admire him, I freely admit it,               http://www.ccil.org/~cowan
and when his time comes I shall                cowan_at_ccil.org
buy a piece of the rope for a keepsake.
Received on Thu Mar 15 2007 - 22:32:51 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC