jckarter/clay — Issue #128: Make open variants safe to use across compilation units
Author: jckarter
Created: 2012-01-03 17:59:51+00:00
State: open
Labels: v0.2

Things will break currently if an open variant type is compiled with different instances in different compilation units. This is dumb.

* Open variants should be given a different syntactic form from closed variants, perhaps:

```
variant Open (A, B, ..); // Type is publicly open
variant Open (A, B, private ..); // Type is public, but only I get to extend it
variant Closed (A, B); // Type is closed
```

This will allow closed and privately-open variants to retain their current cheap representation.

* The tags for open variants should be pointers to dummy symbols or something similar that will be unique at link time.
* Dispatch on open variants will need to be codegenned in a way that allows other units to extend the set of cases. This may not be possible without whole-program chicanery.