From: David Mentre <David.Mentre@inria.fr>
To: JayR <jcriddle4@home.com>
Cc: caml-list@inria.fr
Subject: False polymorphic (was: Re: [Caml-list] native code debugging)
Date: 09 Aug 2001 09:10:44 +0200 [thread overview]
Message-ID: <qtlhevhbte3.fsf_-_@pochi.inria.fr> (raw)
In-Reply-To: <3B71E904.4016B6E7@home.com>
JayR <jcriddle4@home.com> writes:
> # let id x = x;;
> val id : 'a -> 'a = <fun>
This expression is fully polymorphic.
# id 7;;
- : int = 7
# id "w";;
- : string = "w"
> # let id2 = id id;;
> val id2 : '_a -> '_a = <fun>
This one is not (notice the underscore (_) before the type variable
a). It is a monomorphic type that is right know unknown but will be
determined at first instantiation.
> # id2 7;;
> - : int = 7
# id2;;
- : int -> int = <fun>
You see, you now have int instead of '_a.
> # id2 "w";;
> This expression has type string but is here used with type int
So of course the type does not match with a string parameter.
For further information on this subject, have a look at the FAQ:
http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#variables_de_types_faibles
Best regards,
d.
--
David.Mentre@inria.fr
Opinions expressed here are only mine.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
prev parent reply other threads:[~2001-08-09 7:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-08 18:35 [Caml-list] native code debugging Chris Hecker
2001-08-09 1:36 ` JayR
2001-08-09 7:08 ` Florian Hars
2001-08-09 7:10 ` David Mentre [this message]
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=qtlhevhbte3.fsf_-_@pochi.inria.fr \
--to=david.mentre@inria.fr \
--cc=caml-list@inria.fr \
--cc=jcriddle4@home.com \
/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