| ... | ... | @@ -16,7 +16,7 @@ class closed ... where |
|
|
|
|
|
|
|
this will mean that even if the class is exported no one may declare more instances for it
|
|
|
|
|
|
|
|
## alternate
|
|
|
|
## alternate, better proposal
|
|
|
|
|
|
|
|
|
|
|
|
specify it in the export list
|
| ... | ... | @@ -25,12 +25,14 @@ specify it in the export list |
|
|
|
module Foo(closed Foo(..)) where
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
this has the advantage that you can create instances in several modules in a private implementation then export them closed in the public interface. it also fits in nicely with the idea of explicit namespaces in the [ModuleSystem](module-system) and the readonly modifier in the [ReadonlyConstructors](readonly-constructors) proposal.
|
|
|
|
|
|
|
|
## pro
|
|
|
|
|
|
|
|
- compilers based on jhc's class system can take very good advantage of such declarations when optimizing.
|
|
|
|
- This sort of thing is often needed when doing phantom type and type class tricks.
|
|
|
|
- this is available in helium in order to increase the accuracy of error messages to good effect.
|
|
|
|
- syntax is similar to 'class alias' and 'class overlapping' proposals
|
|
|
|
|
|
|
|
## con
|
|
|
|
|
| ... | ... | |