From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA10722 for caml-red; Tue, 2 Jan 2001 18:03:25 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA27752 for ; Tue, 2 Jan 2001 14:11:45 +0100 (MET) Received: from julie.univ-savoie.fr (univax.univ-savoie.fr [193.48.120.32]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f02DBib20490; Tue, 2 Jan 2001 14:11:45 +0100 (MET) Received: from univ-savoie.fr (bppp1.univ-savoie.fr [193.48.120.20]) by julie.univ-savoie.fr (8.9.3/jtpda-5.3.3) with ESMTP id OAA20565 ; Tue, 2 Jan 2001 14:11:43 +0100 (CET) Message-ID: <3A52273B.E55BE243@univ-savoie.fr> Date: Tue, 02 Jan 2001 14:08:43 -0500 From: Christophe Raffalli Organization: Laboratoire de =?iso-8859-1?Q?Math=E9matiques?=, =?iso-8859-1?Q?Universit=E9?= de Savoie X-Mailer: Mozilla 4.76 [fr] (X11; U; Linux 2.2.17-21mdk i686) X-Accept-Language: fr, en MIME-Version: 1.0 To: Didier.Remy@inria.fr, caml-list@inria.fr Subject: Re: A proposal for overloading ... References: <4.3.2.7.2.20001226151428.00b2f680@shell16.ba.best.com> <3A4BA041.F878C6BE@univ-savoie.fr> <20010102113830.A8127@morgon.inria.fr> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: weis@pauillac.inria.fr Didier Remy a écrit : > > Christophe, > > I am afraid that the picture might be far more complicated that what your > description suggests. Of course, two identifiers might have ambiguous > types when considered alone, but become unambiguous when combined together > in a program (this is at the basis of overloading, when the context should > be used to desambiguate). For instance, > > foo: int -> int or string -> string > bar: string or bool > > Then, (for, bar) is ambiguous but (foo bar) is not. > > However, to solve the latter case seems to imply something more complicated > than your simple schema. My proposal would not solve this problem automatically but at least it will give overloading of arithmetical operator (if you still keep separate constants) and a few others. It is clear that if you want something more general, you need an algotihm that implements some kind of bactracking or that infer all the possible types and altough it is possible, it seems much more complex ... > > The above example is just a basic example of overloading. There are many > variations involving ambiguous (maybe polymorphic) local bindings that are > used non-ambiguously for which it is not clearly whether their should be > ambiguity should be resolved or propagated. > > In summary you cannot save the effort of a careful formal specification of > what is an overloaded symbol, how overloading is propagated, and how it is > resolved. > > > Then, if there is still some identifiers with ambiguous value, we choose > > one (the first by position in the source code ?), and assign it the > > first possible value in the list (this choice insure compatibility with > > existing code). > > Both notions (first position in the code, first possible value in the list) > seems completely meaningless to me. But this is that actual semantics of most functionnal language ! > Cheers, > > Didier -- Christophe Raffalli Université de Savoie Batiment Le Chablais, bureau 21 73376 Le Bourget-du-Lac Cedex tél: (33) 4 79 75 81 03 fax: (33) 4 79 75 87 42 mail: Christophe.Raffalli@univ-savoie.fr www: http://www.lama.univ-savoie.fr/~RAFFALLI