Why do #coerce _and_ #as_widget exist?

Adrien Nader <[email protected]> Sat, 14 Sep 2013 16:55:52 +0200
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
Hi,

I'm working on a presentation about lablgtk and there's something I've
always had issues with: #coerce and #as_widget.

The README file says:
* a coerce method, returning the object coerced to the type widget.
* an as_widget method, returning the raw Gtk widget used for packing,
  etc...

However, for the #pack method of boxes for instance, it's #coerce which
has to be used, not #as_widget.

Was it impossible to hide these conversions away from the user?

Why are there two methods which do almost the same thing? Was it not
possible to only require the user to call #coerce and then do #as_widget
automatically inside the bindings?

What are the criteria to know when to use which?

Thanks,
Adrien Nader