caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Obj.magic and "coe"
@ 2002-01-26  3:15 Collin
  2002-01-26 14:38 ` Patrick M Doane
  0 siblings, 1 reply; 2+ messages in thread
From: Collin @ 2002-01-26  3:15 UTC (permalink / raw)
  To: caml-list


Hello;

I was trying to pick up labltk and looking at the example code and I'm
confused by this:
Tk.pack [coe b]

When I change it to:
Tk.pack [b]

It seems to work just as before. I see coe preceding the widgets in
pack calls throughout the labltk examples. I looked up coe in widget.ml
and it looks like some really deep manure. I have no idea what it
means. If someone tries to really explain it, I will have no idea what
they are talking about. Perhaps someone could just give me a hacker's
explanation of why it's in the pack calls.

Thank you,
Collin Monahan

=====
"Better to light one candle than to curse the darkness"
"This little light of mine, I'm gonna let it shine"
SOAP (n) - A "Simple" protocol which requires a Master's degree to use.

__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com
-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Obj.magic and "coe"
  2002-01-26  3:15 [Caml-list] Obj.magic and "coe" Collin
@ 2002-01-26 14:38 ` Patrick M Doane
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick M Doane @ 2002-01-26 14:38 UTC (permalink / raw)
  To: Collin; +Cc: caml-list

You need to use 'coe' if you want to pack two different kind of widgets in
the same function call.  For example,

let b = Button.create ...
let t = Text.create ...
pack [coe b; coe t]

You could think of 'coe' as a cast operator to a generic widget object.
That way, all elements in the list have the same type and the typechecker
is happy.

Note that when only widget is being packed, it isn't needed.

Hope that helps,
Patrick



On Fri, 25 Jan 2002, Collin wrote:

>
> Hello;
>
> I was trying to pick up labltk and looking at the example code and I'm
> confused by this:
> Tk.pack [coe b]
>
> When I change it to:
> Tk.pack [b]
>
> It seems to work just as before. I see coe preceding the widgets in
> pack calls throughout the labltk examples. I looked up coe in widget.ml
> and it looks like some really deep manure. I have no idea what it
> means. If someone tries to really explain it, I will have no idea what
> they are talking about. Perhaps someone could just give me a hacker's
> explanation of why it's in the pack calls.
>
> Thank you,
> Collin Monahan
>
> =====
> "Better to light one candle than to curse the darkness"
> "This little light of mine, I'm gonna let it shine"
> SOAP (n) - A "Simple" protocol which requires a Master's degree to use.
>
> __________________________________________________
> Do You Yahoo!?
> Great stuff seeking new owners in Yahoo! Auctions!
> http://auctions.yahoo.com
> -------------------
> 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
>

-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-26 14:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-26  3:15 [Caml-list] Obj.magic and "coe" Collin
2002-01-26 14:38 ` Patrick M Doane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).