From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA26589; Tue, 2 Jul 2002 20:58:20 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA27931 for ; Tue, 2 Jul 2002 20:58:19 +0200 (MET DST) Received: from leia.mandrakesoft.com (office.mandrakesoft.com [195.68.114.34]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g62IwIb16545; Tue, 2 Jul 2002 20:58:18 +0200 (MET DST) Received: by leia.mandrakesoft.com (Postfix, from userid 505) id 66CD73EF1; Tue, 2 Jul 2002 20:57:36 +0200 (CEST) To: Xavier Leroy Cc: caml-list@inria.fr Subject: Re: [Caml-list] simple typing question References: <200207020914.LAA16152@pauillac.inria.fr> <200207020949.g629nQ606959@orchestra.cs.caltech.edu> <20020702134226.A18305@pauillac.inria.fr> From: Pixel Date: 02 Jul 2002 20:57:36 +0200 In-Reply-To: <20020702134226.A18305@pauillac.inria.fr> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Xavier Leroy writes: > No reasonably simple type system can distinguish both examples. Many > have been proposed -- this was a hot research topic in the 1980-1993 > time frame, and I even did my PhD on this very topic -- but none was > found to be really usable in practice. The value restriction on > polymorphism (i.e. what Caml implements) is far from perfect, but is > the "least bad" of the known solutions. what about changing the semantic of partial application, restoring eta-equivalence: a function is not evaluated unless every arguments are given: make_toggle() <=> fun x -> make_toggle () x of course this makes functions like "make_toggle" quite useless: # let make_toggle () = let r = ref [] in fun x -> let old = !r in r := x; old would be semantically equivalent to # let make_toggle () x = let r = ref [] in let old = !r in r := x; old To get back the power of "make_toggle"-like functions, a special function call could be added that would break eta-equivalence: call_now(make_toggle, ()) would have the semantic "make_toggle()" has in today's caml. The rationale for this change would be that "make_toggle"-like functions are seldom used, whereas "map"-like are used a lot. Differentiating syntactically them would be nice. But i don't think such a big change would do caml any good: - are "make_toggle"-like functions really seldom used? - performance drawbacks? (i've been toying around the syntactical pb of partial application: http://merd.net/choices_syntax.html) ------------------- 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