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
[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
Jacques Garrigue <> writes:


> Another problem is that it is asymmetric: partial applications could
> be polymorphic, but not results containing several functions:
> let both f = ( f, List.iter f)

sorry, i don't understand that pb.


> let toggle r x = let old = !r in r := x; old
> let make_toggle () = let r = ref [] in toggle r

or worse:

let make_toggle toggle = let r = ref [] in toggle r

no way to know how many parameters toggle can have, so no easy way to
eta-expand. I think it *can* be done at evaluation time, but I'm not

so my response to Francois Pottier was wrong:

>> >   # let apply f x = f x;;
>> >   val apply : ('a -> 'b) -> 'a -> 'b = <fun>
>> > 
>> > ... 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.

which was wrong: (even if Francois didn't bother telling :)

# let id f = print_string "foo" ; f

no simple way to eta-expand. Once again, I think it *can* be done at
evaluation time...


> So, this seems unlikely such changes would go through.

i'm aware of this :)

I wanted to note that partial application semantic is somewhat nasty
when combined with eager evaluation, and that syntactically &
typefully separating functions-returning-functions and
partially-applied-functions could ease understanding.

One way to do this is to add sugar for partial application of tuples,
and having tuples the *default* way of passing parameters.
(once again :)

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: