From: Jonas Jensen <jj@issuu.com>
To: Goswin von Brederlow <goswin-v-b@web.de>
Cc: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] RFH: can't figure out why my QT5 widget bindings segfault
Date: Thu, 31 Mar 2016 13:00:31 +0200 [thread overview]
Message-ID: <CAExvvWxchx6OPafTZ7Z_5+iT2QNUOKJjT1ckU8wz3ELiUxnCaQ@mail.gmail.com> (raw)
In-Reply-To: <20160331102118.GA17174@frosties>
On 31 March 2016 at 12:21, Goswin von Brederlow <goswin-v-b@web.de> wrote:
>
> 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.
The phantom-types approach looks attractive. What would be the problem
with it? Obviously, those long types should not be written by hand but
could be aliases, like
type widget = [ `Widget | `Object | `PaintDevice ]
type abstractButton = [ `AbstractButton | widget ]
type pushButton = [ `PushButton | abstractButton ]
And then a handle to a push button would have type "pushButton
oClass". A function taking any widget would have type "[> widget ]
oClass -> ...".
next prev parent reply other threads:[~2016-03-31 11:00 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
2016-03-31 11:00 ` Jonas Jensen [this message]
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=CAExvvWxchx6OPafTZ7Z_5+iT2QNUOKJjT1ckU8wz3ELiUxnCaQ@mail.gmail.com \
--to=jj@issuu.com \
--cc=caml-list@inria.fr \
--cc=goswin-v-b@web.de \
/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