Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] simple typing question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pixel <pixel@m...>
Subject: Re: [Caml-list] simple typing question
Francois Pottier <francois.pottier@inria.fr> writes:

> On Wed, Jul 03, 2002 at 02:39:02AM +0200, Pixel wrote:
> > 
> > based on the number of parameters of functions (given by the type).
> 
> There is no such thing as the `number of parameters of a function'
> in ML. Consider the following example:
>   
>   # let apply f x = f x;;
>   val apply : ('a -> 'b) -> 'a -> 'b = <fun>
>   # apply (fun x -> x) 1;;
>   - : int = 1
>   # apply (fun x y -> x + y) 1 2;;
>   - : int = 3
> 
> ... and so on. You can write applications of `apply' with any
> numbers of arguments.

you're right... but this isn't a problem for the stuff i'm talking.

If "wrapping-restoring-eta-equivalence" is done based on the number of
parameters *before* instanciation of type variables, it will do.

[...]

> Besides, your restriction amounts to preventing functions from returning
> functions, which doesn't make much sense in a functional language, in my
> opinion.

First of all i don't say it's practical/useful/whatever.

But it doesn't prevent returning functions. It *does* change the
evaluation strategy for functions returning functions. This changes
the semantic:
  in "let f() = let v = foo in fun x -> bar"
- if "foo" doesn't terminate, the semantic is different
- if "foo" has side-effects, the semantic is different
-------------------
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