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 KAA11190 for caml-red; Tue, 22 Aug 2000 10:33:15 +0200 (MET DST) 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 DAA07910 for ; Tue, 22 Aug 2000 03:39:09 +0200 (MET DST) Received: from mail1.microsoft.com (mail1.microsoft.com [131.107.3.125]) by concorde.inria.fr (8.10.0/8.10.0) with SMTP id e7M1d7f25555 for ; Tue, 22 Aug 2000 03:39:08 +0200 (MET DST) Received: from 157.54.9.101 by mail1.microsoft.com (InterScan E-Mail VirusWall NT); Mon, 21 Aug 2000 18:38:44 -0700 (Pacific Daylight Time) Received: by INET-IMC-01 with Internet Mail Service (5.5.2651.58) id ; Mon, 21 Aug 2000 18:38:45 -0700 Message-ID: <2CCC2A4C8D41EC4991B547B3595F1A7265B7A9@red-pt-01.redmond.corp.microsoft.com> From: Manuel Fahndrich To: "'John Max Skaller'" Cc: caml-list@inria.fr Subject: RE: Return type of procedures? Date: Mon, 21 Aug 2000 18:38:27 -0700 X-Mailer: Internet Mail Service (5.5.2651.58) Sender: weis@pauillac.inria.fr John Max Skaller wrote: > My language supports polymorhpism, but only at the module level: > if you want parametric polymorphism, you must put the function > in a module, currently the slightly hacked: > > module ident[] { id: T-> T; } > >This means that when the function is used, the module must >be instantiated: > > x = ident[].id (y); > >and the error is detected at instantiation time. Again, in this example, it is easy to detect, but in general it might not be. I'm assuming I can write something like the following in your language: module Foo[] { bar: (unit -> T) -> void; } = struct func localid(x : T) { return(x); } proc bar(f : unit -> T) { let x:T = local_id(f()) in return(); } end Now suppose you have a procedure p : unit -> void and I do Foo[].bar(p); The fact that you are instantiating 'localid' with void is no longer obvious. In the worst case you have to fully instantiate the entire module, including every single local definition, nested module instantiations etc... essentially C++ template application, in order to detect the violation. To me it looks like you want to have two distinct arrow constructors, one for functions -f> and one for procedures -p>. Then you can't go wrong. -Manuel