Message-ID: <3EB64B7F.4040604 at lix.polytechnique.fr> Date: Mon, 05 May 2003 13:31:11 +0200 From: Benjamin Monate MIME-Version: 1.0 To: Richard Jones Cc: lablgtk at kaba.or.jp Subject: Re: More GtkHtml questions References: <20030503100346.GE24136 at redhat.com> <16051.59001.830936.263287 at karryall.dnsalias.org> <20030504141338.GA9710 at redhat.com> <20030505095109.GA10796 at redhat.com> <16054.16579.173448.942063 at akasha.ijm.jussieu.fr> <20030505110949.GB10796 at redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Richard Jones wrote: > > >I'm not sure exactly what the difference is between: > >method cut = cut obj > >and > >method cut () = cut obj > >Doesn't the first define a partial function requiring one additional >argument (the unit) before it is called? > > No. In the first case: let x = o#cut in... x has the same type as "cut obj". In the second case, let x= o#cut in ... x has type unit -> type of "cut obj". In this case you may use directly x#cut as an argument to a callback. In lablgtk, methods having side effects always have an extra unit argument as explained in the README. >I have another question. I've defined a "font_style" type as: >... >Of course in Caml these are variants, not just integers, so you can't >do logical operations on them. I'm not sure if there's an easy way to >solve this in Caml - except by having some C native functions for >converting font_style to integers and/or performing logical >operations. This doesn't seem type safe to me. Do you have any >opinions on the best way to solve this? > In lablgtk, we use lists to denote disj/cunjunctions. You may provide something like : val set_font_style : html -> ~enable:font_style list -> ~keep:font_style list -> unit Cheers Benjamin