Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
OO design
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dan Grossman <djg@c...>
Subject: Re: [Caml-list] Re: OO design

I believe
is relevant, claiming that phantom types can encode any first-order 
subtyping hierarchy.

If I recall correctly, you force the client to provide "witnesses" 
(i.e., coercions), which to answer a later question in the thread, is 
how you can support things like passing a "read_write" file handle to 
read.  That is, you have a functions like:

val up_to_read : read_write file -> read file
val up_to_write : read_write file -> write file

These are the identity function and we can expect cross-module inlining 
to remove them.


Geoffrey Alan Washburn wrote:
> Dan Grossman wrote:
>> It enforces that you don't confuse your reads and writes, but *not* 
>> that you don't use a file after you close it.  A monadic approach 
>> (where each operation would return a "new" file) or linearity appears 
>> necessary for the latter.
>     Okay, good point.  However, that raises the interesting question of 
> whether there is a nice positive specification of the class of 
> "protocols" that are expressible in the presence of effects, rather than 
> a negative characterization -- all those that can be broken by aliasing, 
> nontermination, etc.
> _______________________________________________
> Caml-list mailing list. Subscription management:
> Archives:
> Beginner's list:
> Bug reports: