Date: Tue, 15 May 2001 17:46:18 +0200 To: Jacques Garrigue Cc: Benjamin.Monate at lri.fr, lablgtk at kaba.or.jp Subject: Re: Glade support Message-ID: <20010515174618.A9532 at lambda.u-strasbg.fr> References: <20010515113847.74211da1.Benjamin.Monate at lri.fr> <20010515184710E.garrigue at kurims.kyoto-u.ac.jp> <20010515124617.18099399.Benjamin.Monate at lri.fr> <20010516002810A.garrigue at kurims.kyoto-u.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010516002810A.garrigue at kurims.kyoto-u.ac.jp>; from garrigue at kurims.kyoto-u.ac.jp on Wed, May 16, 2001 at 12:28:10AM +0900 From: Sven LUTHER Sender: Sven LUTHER On Wed, May 16, 2001 at 12:28:10AM +0900, Jacques Garrigue wrote: > For this to work, both libglade and mlglade stubs should be > compatible. A possible way to do that is making the basic interface a > simple class, where each method returns a widget in the > layout. Classes are better than modules at this, because they can be > used dynamically. mmm, how would you use this ? You would have one class containing one method per callback, and passed to the function building the interface ? the user would then have to create an instance of that class to fill in the callbacks. What about actions that can be performed on the interface (suppose you want to draw some stuff in a drawing area) ? I like the functor solution, as it permits me to write more readeable code, don't know how you would do this with classes, but then i mostly never used classes. my current approach is something like : I have a functor that does that contains the callbacks : module CB : T_CB = functor (D : T_Draw) -> struct ... define callbacks here ... end then i have the interface per see, in 2 part : module D : T_Draw = struct ... define actions here ... end module Interface = functor (CB : T_CB) -> struct ... build the interface here ... let main () = ... end and the main program : module CB = Callback.CB (Interface.D) module Interface = Interface.Interface (CB) let main () = ... Interface.main () main () Sure, the real problem with this is that the modules are not dynamic, but how would you do this in oo style ? Friendly, Sven Luther