Browse thread
Attach an invariant to a type
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Dawid Toton <d0@w...> |
| Subject: | Re: [Caml-list] Attach an invariant to a type |
> I guess that making types like "int" private would require the system > (among other things) to decide whether you're using a given integer as > a Subindex.t or not. Suppose we have "type t = private int" in module Subindex. Is the following construct legal: let (a:Subindex.t) = 2 ? It shouldn't be - to prevent me from constructing values of this type. So I couldn't "use given integer as Subinddex.t".