From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,15bb83df7cabf157 X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Re: is there a FAQ? Date: 1998/05/16 Message-ID: #1/1 X-Deja-AN: 353831108 References: <6ji9o8$5t6$1@nnrp1.dejanews.com> Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: 895337686 29807 bpr 206.184.139.132 Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-05-16T00:00:00+00:00 List-Id: On Sat, 16 May 1998, Robert A Duff wrote: > Type inference seems like a nice thing locally, within a single > subroutine, but it seems to me that the interface (to a subroutine, or > package, &c) should be written out explicitly. Interfaces are written out explicitly in the ML signatures. From the OCAML docs module type PRIOQUEUE = sig type priority = int type 'a queue val empty : 'a queue val insert : 'a queue -> int -> 'a -> 'a queue val extract : 'a queue -> int * 'a * 'a queue exception Queue_is_empty end;; spells out the interface clearly if you read a bit of ML ('a is a type variable and can stand for a type, 'a queue is a queue of 'a, int -> real is a functio mapping ints to reals, and * constructs tuples). In a way its more explicit than Ada (exceptions are part of the signature) and in a way less, as I can't restrict the priorities to some range. SML is similar. The biggest problems with these schemes IMO are the lack of human engineering in the error reporting and the difficulty of integrating useful overloading (so called ad-hoc polymorphism, Ada's forte) with type inference. The first is a matter of sweat and time, the second may be too hard.* -- Brian (* I know about multi-parameter type classes in Gofer/Haskell. If people are still as convinced in 5 years... )