Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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,
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