Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Obj.magic and "coe"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-01-26 (14:40)
From: Patrick M Doane <patrick@w...>
Subject: Re: [Caml-list] Obj.magic and "coe"
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,

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
> 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!
> -------------------
> Bug reports:  FAQ:
> To unsubscribe, mail  Archives:

Bug reports:  FAQ:
To unsubscribe, mail  Archives: