From: Manuel Fahndrich <maf@microsoft.com>
To: "'John Max Skaller'" <skaller@maxtal.com.au>
Cc: caml-list@inria.fr
Subject: RE: Return type of procedures?
Date: Mon, 21 Aug 2000 18:38:27 -0700 [thread overview]
Message-ID: <2CCC2A4C8D41EC4991B547B3595F1A7265B7A9@red-pt-01.redmond.corp.microsoft.com> (raw)
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[<T>] { id: T-> T; }
>
>This means that when the function is used, the module must
>be instantiated:
>
> x = ident[<void>].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[<T>] { 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[<void>].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
next reply other threads:[~2000-08-22 8:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-08-22 1:38 Manuel Fahndrich [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-08-21 21:59 Manuel Fahndrich
2000-08-22 1:17 ` John Max Skaller
2000-08-21 21:58 David McClain
2000-08-23 6:05 ` John Max Skaller
2000-08-24 8:49 ` Pierre Weis
2000-08-21 17:17 John Max Skaller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2CCC2A4C8D41EC4991B547B3595F1A7265B7A9@red-pt-01.redmond.corp.microsoft.com \
--to=maf@microsoft.com \
--cc=caml-list@inria.fr \
--cc=skaller@maxtal.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox