On Fri, 2005-06-10 at 00:22 -0400, Swaroop Sridhar wrote:
> That is,
>
> (module list
> (defunion (lst 'a) Nil (Cons 'a))
> (append ...)
>
> (export lst append)
> )
>
> Can the importer of this module also do a Cons independent of the append
> interface?
Yes, this is a mess. I think the answer must be either
a) no, because Cons has not been exported, or
b) yes, because exporting a union type necessarily implies
exporting all of its constructors. This is a special case.
My current thought is that (b) is the correct behavior. It is not useful
in this example to export a list that I cannot pattern match.
>
> Also, if I have
> (module list
>
> (defunion (lst 'a) Nil (Cons 'a))
> (append ...)
>
> (define alst Nil)
>
> (export alst) )
>
> Does the recipient also receive the type lst automatically?
I am not sure. Part of me believes that the answer should be yes,
because "alst" is of type "(lst 'a)". However, the other part of me
believes that these are two separate issues, and that "lst" should not
be implicitly exported. This serves to render the type opaque. An opaque
type is not always what you want, but it is sometimes useful.
The problem, however, is that we then have no way to state the type of
"alst".
As a general rule, I tend to favor solutions in which things are not
implicitly exported, but I'm not sure what to do here.
Proposal?
shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev