caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] RFH: can't figure out why my QT5 widget bindings segfault
Date: Thu, 31 Mar 2016 12:21:19 +0200	[thread overview]
Message-ID: <20160331102118.GA17174@frosties> (raw)
In-Reply-To: <20160329222912.GI9386@darkstar>

On Tue, Mar 29, 2016 at 11:29:12PM +0100, SP wrote:
> On Fri, Mar 25, 2016 at 12:28:39PM +0100, Goswin von Brederlow wrote:
> >I've converted to explicit painter#begin_ and painter#end_ calls and
> >added some checks in the bindings to enforce them and now everything
> >works. Now off to adding KeyEvent parsing and one can actually play.
> 
> I think having Qt usable from OCaml would be great.
> 
> But I'm not sure the best way to do it to map the object oriented system
> "one-to-one" with OCaml objects. It will be as tedious to use as it is
> with C++ and keeping track of any changes in the API might be a pain.

I think it is the only sane way. GUI widgets are full of inheritance
and you have tons of functions that can take any widget. Without
objects you would have to use recursive types like

    type t = unit pushButton AbstarctButton.abstractButton Widget.widget Object.oObject OCLass.oClass

(and how do I say that a widget is both an oObject and paintDevice?)

or phantom types like

    type t = [`PushButton | `AbstractButton | `Widget | `Object | `PaintDevice ] OClass.oClass

And that is just for a simple button. Other types would get a lot
longer, not to mention the type for methods taking other widgets where
you have multiple of those types.


From what I see the API doesn't change much. Even between QT4 and QT5
there is only a handfull of API changes. So I don't think tracking
them will be that hard.

Getting the API right and playing ball with the Gc the first time
around is a pain though. One has to be carefull about Qt taking
ownership of the arguments or not, which requires a human reading the
API docs. So I'm afraid automatic stub generation from the header
files is mostly not possible.

> I'd like to follow the progress on this. Will you be posting on the
> mailing list or have you got a blog about this?

You can subscribe to the github repository to see commits, issues,
pull requests etc. But I will probably announce larger milestones on
the mailing list too.  So far it's a proof of concept and I think
having the Tetrix example work proofs the concept viable. So I'm gonna
keep working on this.

MfG
	Goswin

  reply	other threads:[~2016-03-31 10:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-23 10:50 Goswin von Brederlow
2016-03-23 15:18 ` Anatoly Zaretsky
2016-03-23 17:18   ` François Bobot
2016-03-24 10:25     ` Goswin von Brederlow
2016-03-25 11:28       ` Goswin von Brederlow
2016-03-29 22:29         ` SP
2016-03-31 10:21           ` Goswin von Brederlow [this message]
2016-03-31 11:00             ` Jonas Jensen
2016-04-02 11:38               ` Goswin von Brederlow
2016-04-06 22:56                 ` SP
2016-04-07  7:43                   ` Goswin von Brederlow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160331102118.GA17174@frosties \
    --to=goswin-v-b@web.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).