Alastair Reid writes:

> I strongly agree that we should definitely add the ability to 
> declare types 
> whose definition is provided externally.  (i.e., provide the 
> feature that empty datatype decls currently provide.)
> 
> Before adding them, we need to agree on the semantics and 
> syntax (in that order I think).
> 
> The obvious semantics based on the syntax is:
> 
> [[
>   The declaration
> 
>     data T
> 
>   introduces a type T whose only value is bottom.
> ]]
> 
> This semantics is obviously flawed though because it would 
> suggest that any 
> two values of type T are equal (and equal to bottom) and that 
> optimizations 
> based on that equality are valid.  Using an unpointed type 
> (i.e., the value 
> is not bottom) or saying there are no values bottom or 
> otherwise don't help.
> 
> The correct semantics has to be something roughly like:
> 
> [[
>   The declaration
> 
>     data T
> 
>   declares a type T whose set of values are defined externally to the
>   language. [optional sentence: There are no legal Haskell operations 
>   on values of type T.]
> ]]

If we were actually using values of type T in the way you suggest, I would agree.  But 
the way these empty datatypes are being used
is as dummy type arguments to Ptr, as in 'Ptr T'.  So I don't think there's any need 
to give special semantics to datatypes declared
with empty declarations.

(this is essentially what Marcin just said, but I'm being a bit more verbose).

Cheers,
        Simon

_______________________________________________
FFI mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/ffi

Reply via email to