Re: Binding for gtkSourceView-2.0

Mike Spivey <[email protected]>
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
Benjamin Monate wrote:
> If you intend to do it yourself, do not hesitate to post regular
> progress/status reports so that we can help you.

I have made a rough draft of a binding, but have only just begun to test
it.  I don't know if I will find the time to test and debug those parts
that I don't need for my current project.

My experience so far is that more than 50% of the C primitives I've
written have conversion problems, so testing is very important.  I hope
things get better with time.

However, I'm very willing to share what I have once some parts of it are
working.

For now, a couple of interface questions:

(1) Is there a fixed rule for what methods take () as a final parameter?
 Methods with side effects and no arguments, yes; but what about methods
like

	method guess_language :
	  ?filename:string -> ?content_type:string
	    -> unit -> source_language (* or raise Not_found *)

that have no side-effects and only optional arguments?

(2) On the same example: if a C method with type t may return NULL, then
we have multiple possibilities in OCaml:

	(i)   return "t option"
	(ii)  return "t", but raise Not_found if the result is NULL
	(iii) if t = string, then return the empty string for NULL

A similar question applies to arguments that may be NULL.  Is there a
rule that I should follow?

(3) Text iterators are wrapped in a non-mutable way, with

	method forward_char : iter

returning a fresh iterator.  But in gText.view there is a method

	method forward_display_line_end : iter -> bool

that mutates its argument.  Can this be right?

And finally: is it possible to have a C primitive that takes labelled
arguments?

Best wishes,

-- Mike
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.