Version franēaise
Home     About     Download     Resources     Contact us    
Browse thread
Compiler feature - useful or not?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Till Varoquaux <till.varoquaux@g...>
Subject: Re: [Caml-list] Compiler feature - useful or not?
Funny you'd be talking to the creator of CDuce (www.cduce.org) about
defining types as sets...

Till

On Nov 16, 2007 11:43 AM, Martin Jambon <martin.jambon@ens-lyon.org> wrote:
> On Fri, 16 Nov 2007, Martin Jambon wrote:
>
> > On Fri, 16 Nov 2007, Alain Frisch wrote:
> >
> >>  Martin Jambon wrote:
> >> >   You can write
> >> >     match (x : Priv_int.t) with 0 -> true | _ -> false
> >>
> >>  Actually, you cannot do that, at least with private types as implemented
> >>  in OCaml's CVS. And this is to be expected given the lack of implicit
> >>  subsumption in OCaml. If you were able to do such a thing, what type
> >>  schema would you give to:
> >>
> >>   let f = function 0 -> true | _ -> false
> >>
> >>  ?
> >
> > Using the notation for polymorphic variant types:
> >
> > val f : [< int ] -> bool
> >
> > Type [> int ] would be the same as [ int ] or int.
>
> Please don't take my suggestions too seriously, but it could be cool to
> define types such as:
>
> type bit = [ 0 | 1 ]
>
>
> Martin
>
>
> --
> http://wink.com/profile/mjambon
> http://martin.jambon.free.fr
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>



-- 
http://till-varoquaux.blogspot.com/