From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 36D467EE34 for ; Thu, 31 Mar 2016 13:00:33 +0200 (CEST) IronPort-PHdr: 9a23:5DXuKRwtrAIaEaXXCy+O+j09IxM/srCxBDY+r6Qd0e0VIJqq85mqBkHD//Il1AaPBtWLrakcwLGP+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuSt6U1Jz8jLn60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGx48sgs/M9YUKj8Y79wDfkBVGxnYCgJ45jEsgLcTA3H+HwaGk8MnxZFGQzC81muUZDqrSr88/Q40gGFMMewQb1iChq46KI+ahjugTxPFTM/62zRwphyjopauwm8ulp0xIuCM9LdD+Z3Yq6IJYBSfmFGRMsEEnUZWo4= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jj@issuu.com; spf=Pass smtp.mailfrom=jj@issuu.com; spf=None smtp.helo=postmaster@mail-lf0-f54.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jj@issuu.com) identity=pra; client-ip=209.85.215.54; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jj@issuu.com"; x-sender="jj@issuu.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of jj@issuu.com designates 209.85.215.54 as permitted sender) identity=mailfrom; client-ip=209.85.215.54; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jj@issuu.com"; x-sender="jj@issuu.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-lf0-f54.google.com) identity=helo; client-ip=209.85.215.54; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jj@issuu.com"; x-sender="postmaster@mail-lf0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BAAgBQAv1WkjbXVdFdhQQGthuFAoFwhH2BEAKBOAc5EwEBAQEBAQEBEQEBAQEHCwsJIS+CLYIVAQEEEhEEGQEBNwEPCwsNAgImAgIiEgEFARwGEyKHcAMSonmBMT4xik9nhEEBBIdHIoRwAQEBAQEFAQEBARYGCnKFIoRGhz6CVgGXdocghmiPDY1YER6BDiIBgjYegVQ6MIhtAQEB X-IPAS-Result: A0BAAgBQAv1WkjbXVdFdhQQGthuFAoFwhH2BEAKBOAc5EwEBAQEBAQEBEQEBAQEHCwsJIS+CLYIVAQEEEhEEGQEBNwEPCwsNAgImAgIiEgEFARwGEyKHcAMSonmBMT4xik9nhEEBBIdHIoRwAQEBAQEFAQEBARYGCnKFIoRGhz6CVgGXdocghmiPDY1YER6BDiIBgjYegVQ6MIhtAQEB X-IronPort-AV: E=Sophos;i="5.24,422,1454972400"; d="scan'208";a="171843171" Received: from mail-lf0-f54.google.com ([209.85.215.54]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 31 Mar 2016 13:00:32 +0200 Received: by mail-lf0-f54.google.com with SMTP id c62so56762756lfc.1 for ; Thu, 31 Mar 2016 04:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=issuu.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=9eSf/qJGFAjq8iMkwuzA/OyccNjfeGhe1jxHneLfi3c=; b=Jc7LbPJOYUXsQR+UKf31YbTG4+UM34pcv0B3waz4c35GIPvrWniKmgrVR0DQZlZ32b 1n1BHrP6Z3sbs2MipymfwtYKtesTAp3XlLEeCjGcnn7aKOdTK3wNfOE15hajT6zTlE8s SqVot4DNEC0nn8qUbGC5SLU9FOnpNP/4CMJ20= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=9eSf/qJGFAjq8iMkwuzA/OyccNjfeGhe1jxHneLfi3c=; b=l+EC/nx4Y5rVp4qGoHkqTlnRp47Dm4LMn6BrdW6Jiyz+kLwjtd3aj6vRwZ9BU4IacD zDvtKKS0FAIDrErb1MqcDaMzFSGQutK54b/l5eSLbVojqoqGppigO7eNx0hN0dp3K1l5 iR+fKYgYc+aOeoNbbnpdNOIW3azfZpvJ/hCr8+0+1Qzs+/pfZOBF039PGtEKlri9k6wd 5uxQNsnMGr691Tk8v1SHd2oq2hjezWurPYK3cPwPBqlmXjnp/esPv744qw6yjRWsRliw tOtnVCqtJlqTS6kSlJutrv3IkBLe5EhFDYCenFeEhZa2a0JfJQx1BaO3Jeelxwu79q8q QGTg== X-Gm-Message-State: AD7BkJIu0BmpUMPXnAJhKhaSp0Fpl8RXctn3QfbrVn6f7salE/m7Nl9PP1RT4BdcINW3BcsMLiDuzPCNp0PGmsU5 MIME-Version: 1.0 X-Received: by 10.25.18.211 with SMTP id 80mr6367154lfs.127.1459422031461; Thu, 31 Mar 2016 04:00:31 -0700 (PDT) Received: by 10.25.169.74 with HTTP; Thu, 31 Mar 2016 04:00:31 -0700 (PDT) In-Reply-To: <20160331102118.GA17174@frosties> References: <20160323105016.GA2235@frosties> <56F2CFD4.4000401@cea.fr> <20160324102559.GB32689@frosties> <20160325112839.GA27075@frosties> <20160329222912.GI9386@darkstar> <20160331102118.GA17174@frosties> Date: Thu, 31 Mar 2016 13:00:31 +0200 Message-ID: From: Jonas Jensen To: Goswin von Brederlow Cc: Ocaml Mailing List Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] RFH: can't figure out why my QT5 widget bindings segfault On 31 March 2016 at 12:21, Goswin von Brederlow 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 -> ...".