From: Maxence <max@sbuilders.com>
To: Mattias Waldau <mattias@fforum.se>
Cc: caml list <caml-list@inria.fr>
Subject: Re: Typing problems when using LablGTK
Date: Mon, 05 Feb 2001 00:09:48 +0100 [thread overview]
Message-ID: <3A7DE13C.B1CFC6AD@sbuilders.com> (raw)
In-Reply-To: <200102032154.f13LsK116451@fforum.se>
Just add explicit type for the table parameter of your mini function :
let mini (table : GPack.table) : unit =
GButton.button ~label:"mini"
~packing:(table#attach ~left:3 ~top:3 ~expand:`BOTH) ();
()
> What have I misunderstood?
I think you didn't misunderstood anything. I was surprised too, the
first time :-)
take a look at the example below :
class context () =
object
method get_string ?(default="great!") message =
(* this function could display a message and an
entry widget to make the user type in some text.
The entry would contain the default text when
the window appears. for the example, we
just return the default text.*)
print_string message;
default
end
let f ctx = ctx#get_string "how do you feel ?"
let ctx = new context ()
let feeling = f (ctx :> <get_string : string -> string>)
ocaml complains about the coercion of ctx :
This expression cannot be coerced to type < get_string : string ->
string >;
it has type context = < get_string : ?default:string -> string -> string
>
but is here used with type < get_string : string -> string >
The question is : why is this coercion not allowed ?
Maxence Guesdon
next prev parent reply other threads:[~2001-02-05 16:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-03 21:54 Mattias Waldau
2001-02-04 23:09 ` Maxence [this message]
2001-02-05 3:05 ` Jacques Garrigue
2001-02-05 18:18 ` Mattias Waldau
2001-02-06 1:58 ` Jacques Garrigue
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=3A7DE13C.B1CFC6AD@sbuilders.com \
--to=max@sbuilders.com \
--cc=caml-list@inria.fr \
--cc=mattias@fforum.se \
/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