On Sat, Sep 15, 2012 at 10:18 AM, Johannes Qvarford
<
johannes...@gmail.com> wrote:
> Bummer.
> Thanks for the help, though!
If you don't like the naming convention approach, here's something you
can do. Make a variant for the public type, with the private type as
its only member:
```
variant Rectangle (RectangleImpl);
private record RectangleImpl (...);
```
External code will not be able to reference the RectangleImpl type and
thus won't be able to see its fields. Within the module,
`variantAs(RectangleImpl, rect)` will give you a reference to the
RectangleImpl. This has the disadvantages of an extra word of space
overhead for the variant tag, and some boilerplate to access the
private members in the implementation. Eventually we hope to have a
strong typedef feature, like Haskell's newtypes, which will allow this
technique without the overhead of a variant.
-Joe