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 PAA24724 for caml-red; Mon, 18 Dec 2000 15:44:34 +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 WAA23017 for ; Fri, 15 Dec 2000 22:53:29 +0100 (MET) Received: from smtp4.ihug.co.nz (smtp4.ihug.co.nz [203.109.252.5]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eBFLrQj02219 for ; Fri, 15 Dec 2000 22:53:27 +0100 (MET) Received: from [192.168.0.12] (p33-max6.wlg.ihug.co.nz [203.173.231.97]) by smtp4.ihug.co.nz (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id KAA00733; Sat, 16 Dec 2000 10:52:09 +1300 X-Authentication-Warning: smtp4.ihug.co.nz: Host p33-max6.wlg.ihug.co.nz [203.173.231.97] claimed to be [192.168.0.12] Mime-Version: 1.0 X-Sender: bruce@209.163.245.148 Message-Id: In-Reply-To: <3A3663B5.412BECE2@ozemail.com.au> References: <4.3.2.7.2.20001211101656.00c12320@shell16.ba.best.com> <200012120325.WAA12331@bismarck-chet.watson.ibm.com> <3A3663B5.412BECE2@ozemail.com.au> Date: Sat, 16 Dec 2000 10:51:59 +1300 To: John Max Skaller , Chet Murthy From: Bruce Hoult Subject: Re: Same label in different types, how do people solve this? Cc: Chris Hecker , Mattias Waldau , Caml-List Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: weis@pauillac.inria.fr At 4:43 AM +1100 13/12/00, John Max Skaller wrote: >Chet Murthy wrote: > >> The issue, about practicality, isn't whether you _can_ specify the >> particular types and type-usages you want. The issue is whether, if >> you write a phrase, and you got it wrong, you have to know all about >> the type system, in order to debug that phrase. > >It is a tradeoff. Full inference makes code short: lack of >inference severely pollutes programming style (as in C++). >In Felix, I compromised: functions must be explicitly typed >when declared, but values don't: > > function f(a:int): int { val b = a; return b; } > >f must be explicitly typed. The type of b is deduced. That's how most code gets written in Dylan. You need to declare argument types for methods of generic functions so that the polymorphic dispatch can figure out which method to call for which actual arguments. Once you've done that, the compiler can often figure out all the types within the method by itself. Internal functions -- anonymous arguments to things such as map(), and ones used for tail-recursive looping, for example -- don't tend to have their arguments declared. The difference between Dylan and ML-family languages is, of course, that in ML if the compiler can't figure out some types it complains, whereas Dylan just says "oh well, it's , then", and you silently end up with less efficient code. A good compiler will have tools to tell you about this sort of thing when you want to know about it, and ignore it otherwise. -- Bruce