English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    
Browse thread
[Caml-list] OCaml popularity
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: brogoff@s...
Subject: Re: [Caml-list] Re: Haskell-like syntax
That's a good point, though I have to say it hasn't been a problem in 
code I've written when I've wanted top down style. However, if this is such a 
bummer, maybe you should be agitating for polymorphic recursion instead. That 
would remove this complaint (if we didn't have to explicitly annotate; if we 
did, it loses the lightweight aspect) *and* add some power to OCaml. 

If I'm not mistaken, the Revised version of your code does not have that problem. 
Also, if you are really interested in making this happen, the right thing to do 
is to attempt to change Revised, which is the bucket that all syntax 
experimentation is dumped into. 

-- Brian


On 14 Mar 2003, Sebastien Carlier wrote:

> 
> brogoff@speakeasy.net writes:
> 
> > If you are really desparate to be able to do this kind of thing, that is, to 
> > write your programs in a top down fashion, you can do it right now in OCaml, 
> > sans CamlP4, by writing code like 
> > 
> >     let rec main () = 
> >        let foo_arg = foo_aux () in 
> >         foo foo_arg 
> >     and foo = ... 
> >     and foo_aux = ...
> 
> This is different: "let rec" doesn't give you polymorphism in OCaml.
> The following code doesn't pass the type checker because the type of
> "id" is not generalized:
> 
> let rec main () =
>     print_string (id ""); print_int (id 0)
> and id = fun x -> x;;
> 
> In Haskell, "where" generalizes - the following similar code is
> accepted by Haskell compilers:
> 
> main =
>     do putStr (id "")
>        print (id 0)
>     where id = \ x -> x
> 
> -- 
> Sebastien
> 
> 

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners