Browse thread
OO design
[
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: | David Teller <David.Teller@e...> |
| Subject: | Re: [Caml-list] OO design |
On Monday 08 May 2006 05:17, Jacques Garrigue wrote: > I would be tempted to say: there is no answer. > Ocaml objects are not about enforcing protocols, but about allowing > inheritance and structural subtyping, and this does not fit well with > your problem. Which brings us to a question : how do you enforce protocols in OCaml ? Say, is there a "good" way of rewriting file-related operations so that, say, ProtocolUnix.read and ProtocolUnix.write *statically* only accept opened files, and in addition, ProtocolUnix.write only accepts files which have been opened with write priviledges ? I mean, there are manners of checking this with, say, model checking tools. In the specific case of file management, I guess we can do it with a little bit of simple subclassing, but I assume there's a large run-time penalty for this extra bit of checking, due to the management of objects by OCaml. Has anyone attempted to determine how well this scales up ? Or explored other options ? Cheers, David