[m-dev.] Impure support for di/uo ADTs in the library

Ralph Becket rbeck at microsoft.com
Fri Jun 1 20:57:36 AEST 2001


When Tyson was visiting here he suggested that the library could
benefit from a (probably developers-only) module providing unsafe
means of constructing and (destructively) manipulating bits of
memory in order to support the implementation of arrays, stores,
et cetera.

Two real advantages of this scheme would be that 
(a) porting to a new back-end language would only require porting
the unsafe module rather than every module that used it and
(b) it should allow back-end changes to e.g. memory management
with much the same reduction in worry and pain wrt the library.

It's not clear what the interface to the unsafe module should be.
I would imagine something along the lines of
1. a function to allocate a vector of words in memory,
2. per-word access and destructive update of vector elements,
3. a copy function,
4. possibly byte and bit level access/update functions, too.
Bounds checking and type safety and so forth would be the 
responsibility of the ADT implementer.

I imagine this would be easy to implement.

A downside of this approach is that typed back-ends (e.g. MSIL)
may already support particular ADTs and may even prohibit this kind
of unsafe chicanery.

What do people think?

- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list