Date: Thu, 8 Sep 2005 07:35:58 -0300 From: romildo at uber.com.br To: lablgtk at math.nagoya-u.ac.jp Subject: Understanding "include" in lablGtk2 implementation Message-ID: <20050908103558.GA21679 at malaquias> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello. In the process of writing a new OCaml interface to an existing C library (gtkdatabox), I came acrros some points in the lablGtk2 implementation that I do not understand completly. In the message http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk-list/1016, Jacques Garrigue gives some tips on implementing a new lablGtk2 wrapper. Basically he tells to look at an example for learning, and sugests using the Text widget from GtkBroken. I am following his sugestion. In gtkBroken.ml there is the module definition module Text = struct include Text (* ... *) end What is the phrase "include Text" used for here? What does it mean? The OCaml manual says the following about the include expression: (http://caml.inria.fr/pub/docs/manual-ocaml/manual018.html) "The expression include module-type in a signature performs textual inclusion of the components of the signature denoted by module-type. It behaves as if the components of the included signature were copied at the location of the include. The module-type argument must refer to a module type that is a signature, not a functor type." But the phrase used in gtkBroken.ml does not appear in a signature, but in a structure. Where does the module type "Text" come from? Similar include expression are found on other modules too. When I try to mimic this expression in my own module module Databox = struct include Databox (* ... *) end I get an error: # make ocamlc.opt -I +lablGL -w s -c gtkDatabox.ml File "gtkDatabox.ml", line 14, characters 10-17: Unbound module Databox make: *** [gtkDatabox.cmo] Error 2 Any comments? Romildo