Let's get this finished

Manuel M. T. Chakravarty chak at cse.unsw.edu.au
Sat Jan 6 19:58:34 EST 2001


Sven Panne <Sven.Panne at informatik.uni-muenchen.de> wrote,

> "Manuel M. T. Chakravarty" wrote:
> > [...] I see your point, however, personally, I still prefer to
> > have overloading for the common cases (that what we want
> > most of the time when given a particular type) and use
> > explicit functions only for the exceptions.  That makes the
> > resulting code more readable in my opinion - as it contains
> > less clutter for the common case.  But I guess, this is a
> > matter of personal style. [...]
> 
> In the case of CString/Ptr CChar it's not only that: Storable.sizeOf
> should never use its argument, but it would have to in the case of
> variable length C strings. And what should be the semantics of
> {peek,poke}ElemOff here? In a nutshell: instance Storable CString
> makes sense only partially, so I fear there is no other option than
> using non-overloaded functions. Or we have to re-design Storable
> somehow (alignment, peek, peekByte, poke, and pokeByte *do* make
> sense for CString).

That is why I was proposing a two-level hierachy with
Storable and ToAddr/FromAddr.  But it surely requires some
more experimentation.

Cheers,
Manuel





More information about the FFI mailing list