220 33798 <CAFk2RUakgF_ZAt81uhcwn4KzLcbjC04LpqyREHWoKNFe6njDfQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: properties?
Date: Thu, 10 Aug 2017 19:35:57 +0300
Lines: 78
Approved: news@gmane.org
Message-ID: <CAFk2RUakgF_ZAt81uhcwn4KzLcbjC04LpqyREHWoKNFe6njDfQ@mail.gmail.com>
References: <6ed2bd55-5538-418f-8f1a-263a9958babd@isocpp.org>
 <10557c71-2b0f-6675-305e-1267eeda1ed6@gmail.com> <cd0988be-8dc0-43be-96b1-94ec6f8e5e91@isocpp.org>
 <05214462-9ca7-a5c8-018a-4a05faf02f7c@gmail.com> <CAFk2RUb74DztdM5e6cjgEsJeNEqwmy5hWkcTBUa1zJbojb=tCQ@mail.gmail.com>
 <5d2c2db8-9774-4099-82d6-c97b909363ad@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1502382967 23675 195.159.176.226 (10 Aug 2017 16:36:07 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 10 Aug 2017 16:36:07 +0000 (UTC)
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC5JHI7A7ALRB3UWWLGAKGQEXNPJVXY@isocpp.org Thu Aug 10 18:35:59 2017
Return-path: <std-proposals+bncBC5JHI7A7ALRB3UWWLGAKGQEXNPJVXY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pg0-f72.google.com ([74.125.83.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRB3UWWLGAKGQEXNPJVXY@isocpp.org>)
	id 1dfqR6-0005U8-RQ
	for gclcip-std-proposals@m.gmane.org; Thu, 10 Aug 2017 18:35:53 +0200
Original-Received: by mail-pg0-f72.google.com with SMTP id v77sf11663577pgb.15
        for <gclcip-std-proposals@m.gmane.org>; Thu, 10 Aug 2017 09:35:59 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1502382959; cv=pass;
        d=google.com; s=arc-20160816;
        b=gAGl5RcIgjoywfVeIv/2D+G8ms8Cvr6RfHA0zLdeQN/MYSlbWjhMsCKxeCDN+xoB64
         jsSAwR1ckQ9BPWj2BoNWTHwwSyNK2+Z5q319xJykq4SDqdlbinPKwLk55Z1QSPnpzzaq
         7i5T7/1RbnJmtmAdrYSBP92pSkruTewR5ZUyGxu8Q0Wz+fECMxRoZsvCZdPzjsoynH2a
         KauzSJYC8G4kJu7ahLRt+g5jBl59CG1HoK+BwYyr7kNS8VlV0rPK9HZjT7+kndcvi4nM
         GJ4VlkojKBFzf8dr/FO47y94b5tBsxvA5wz3irufcsic7luhnWaUbYTxF3PaD+q4DFk/
         zHcQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=E6FMlVfc9IkFz8670gYgORhT/FqbE5Y7JbXIfPvBQxQ=;
        b=cXd8Y5NFNScxXW2h2P1VvVEvszxkRhTpNeU6V7FjLgD9MC/MpCavTIQ+SbNB37BjLW
         hPfst6HPVW+9FznkBxYw8pk4PkyE+iVykKDE8nNvY+ZbjUMMi5ozAInB+OVeiBqSpjeZ
         6DLG14DNPDKIGyaCXgv6CTYbaRFSu6d9zRmKpQ1Ha0EzTdzT2e9WlQoc0XQSSNP0oOMb
         DdZsfGJU36FDN1TVAl4HNMgZBoe661ZX9y9SyraKnMDViMHepaWW6ydT2JmbNdPzAodE
         fLb0uYfTwCQRtQjNiaqEYiw/EoLUN3tP+Dx7+MUgID/jc4oOj+9otvXF9p/VPOUMDKad
         +nUQ==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=rBGeu30l;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:400c:c05::242 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=E6FMlVfc9IkFz8670gYgORhT/FqbE5Y7JbXIfPvBQxQ=;
        b=AtjQqoMbcGH1sYRE2epNJQIlEB5cp4XYHWn/rUacjJ0fSGVRgrEePNehsFoDyv8bro
         FwbTiRZUyyyebh56fU/qS9DuhEgN4C4EJjfxBJM4mPNXuq455wz04i/sXzwAAcexzIBV
         LfRFZ2dn12b26h2vp2H2uT3VV6x0sfah5ABlxZfzwHMz4zsmvHNce3peWuzQGJFwZECh
         fOkVUjBt8V344H+ZQADjjBCxsia+nuwlBJHcSXUB0QBtrRxjvzuhGGhsHoaLj3dwY3Sk
         gV8uhRAYSONlgfwFzmiAe43aXQvA5bnul8ojuEJKzqVmlAQPFGmXBH9adtCJO1gmuS0k
         PGHQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=E6FMlVfc9IkFz8670gYgORhT/FqbE5Y7JbXIfPvBQxQ=;
        b=qlLCsb1HjkyoQnMKJhqivnZCFTKd192Q7cXHIL0F2i8SogIA8shIX3BiWAigIovcUa
         KO5v6EHWhdaSLQUxB7lcmnOA8MiHhEKE6oQeB6oGykZWCYSk/m10rbMa1JYnICxDlB5/
         n8RqWFDBiBVeLhj3Ybvjt5RQw15XIjiM2PcxmFaJEBvy/fIUmxnVtHKyY3GB28A4RPsC
         dPVwoHExIfRNWp6VDdfP7x4FgAywWH4GbzSAJc1qRnrPCLLgdjPgHEx7qm2zhNoYB6HZ
         t8NiEo+P8GsFa2Q/jAvvcUY5V3k2D2m28LAhBYQ7t6KIt3TOQPB8Ls+aGPdSS0BeY7PC
         Ooug==
X-Gm-Message-State: AHYfb5hOld+I9/7+eVa+e6CireVpghKb+HvzAV0sDFFSGZs1qlxzHVet
	IYzY6ybAuIXi1pwQ
X-Received: by 10.99.119.137 with SMTP id s131mr7888025pgc.42.1502382959012;
        Thu, 10 Aug 2017 09:35:59 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.128.165 with SMTP id k37ls6927752ioi.37.gmail; Thu, 10 Aug
 2017 09:35:58 -0700 (PDT)
X-Received: by 10.176.88.66 with SMTP id p2mr9235209uac.181.1502382957992;
        Thu, 10 Aug 2017 09:35:57 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1502382957; cv=none;
        d=google.com; s=arc-20160816;
        b=JkqFiqF5B07Atpj5WAJ46TvOd/9pCR+mgVW7Tn+3BSToPGYZMQT2jqGMSlQ5y+JlN2
         Di1KuajmtNmKIf6dWkby07WWPBxkefW+aCPeZi9IcSYZ6bqkwfZCiRbQw76q9PdXphHV
         xSHDfqfmCRzU4bo8YVjFT5mZF6UsziRZSzssmC7Dk3liaOHL23evX7jr7VczYnU/fF4w
         uTkR4QquxbrYvFblFIgi0gT07vl57vvuKbhrv3JFZOM7YvQEzDfWxEqMcPMRSc4UFrFf
         75D8RnDRzJW5g0EfCHWVCGdNaC/M9bQBUKQjO4jgOHg1fE/sRuVWxaxC8OaKV53Vr6S5
         ZXhA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :dkim-signature:arc-authentication-results;
        bh=aBKK1X6b8mmoLkzA+qosK3ycn5p01esMjvdMIidNNeA=;
        b=JYVtAdRMOybFk1X4qhMWhUmXBcq1qQSMDzTROBpnqtEbJP4k7iH46JcvbOVyQtQ5QD
         D60c+cMcQkh2BfBgpup5cYzzClMRQdFmq3D99CzD1faqjRdpy2X1XBqflqkFu5xD3IM6
         ZlmARjSMdy5e4Slyx235diYXyFWtqYmvbSM9rSBlpMFrVxfI7NTHoymo6HEb5gdBWJLA
         NG66VicuVzDT0SbBNhYROgmRqEiFwec6Ll/eVqaBaYfXdEfYOg8rMj31gImdoyrm0kNW
         n9h+K+/F0+QTMbRRe4ZEpMrszuIZSlq7UIcKlSLBLWBeefwal78+dZ+QIMfJvFeT/LDE
         3Miw==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=rBGeu30l;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:400c:c05::242 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-vk0-x242.google.com (mail-vk0-x242.google.com. [2607:f8b0:400c:c05::242])
        by mx.google.com with ESMTPS id e30si3715328uag.42.2017.08.10.09.35.57
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 10 Aug 2017 09:35:57 -0700 (PDT)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:400c:c05::242 as permitted sender) client-ip=2607:f8b0:400c:c05::242;
Original-Received: by mail-vk0-x242.google.com with SMTP id z187so547838vkd.3
        for <std-proposals@isocpp.org>; Thu, 10 Aug 2017 09:35:57 -0700 (PDT)
X-Received: by 10.31.206.133 with SMTP id e127mr7831807vkg.145.1502382957501;
 Thu, 10 Aug 2017 09:35:57 -0700 (PDT)
Original-Received: by 10.103.103.65 with HTTP; Thu, 10 Aug 2017 09:35:57 -0700 (PDT)
In-Reply-To: <5d2c2db8-9774-4099-82d6-c97b909363ad@isocpp.org>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=rBGeu30l;       spf=pass
 (google.com: domain of ville.voutilainen@gmail.com designates
 2607:f8b0:400c:c05::242 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:33798
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33798>

On 10 August 2017 at 19:21, Nicol Bolas <jmckesson@gmail.com> wrote:
> On Thursday, August 10, 2017 at 10:40:58 AM UTC-4, Ville Voutilainen wrote:
>>
>> On 10 August 2017 at 17:08, Matthew Woehlke <mwoehlk...@gmail.com> wrote:
>> > Ah. Of course, mixins are sufficiently wide-spread that figuring those
>> > out is almost certainly worthwhile in its own right. (I've always
>> > thought so, anyway.)
>> >
>> > Maybe someone would be interested in taking up the torch on those?
>>
>>
>> I daresay we should see how much we can get via reflection, and then
>> figure out whether we want
>> to add specific facilities.
>
>
> This is not a problem reflection can solve. Or at least, not the problem I
> was encountering with CRTP-based mixins. That problem being the fact that
> the derived class (the class being mixed into) is incomplete at the point
> where the mixin is being instantiated.
>
> That's the catch-22: you need a way to augment a type with new stuff, but
> you also need a way to access the stuff that was previously added to the
> type. And as I understand, you cannot invoke reflection on an incomplete
> type.

You can run metaprograms on a type that is so-called almost-complete,
and the metaprogram completes it.
See http://open-std.org/JTC1/SC22/WG21/docs/papers/2017/p0707r1.pdf.

> And even if you could reflect over a partially complete type, you wouldn't
> be able to access members that haven't been declared yet. And since

Except that you can, if you postpone instantiation of such code to a
time when the members
are available. You generate a template, and then instantiate the
template with the member. The member
does need to be a parameter, but that doesn't change the mixed-in code.

> A proper mixin facility needs the following three properties:
>
> 1: The ability for a type to add the mixin to itself, such that the mixin's
> declarations are able to have access to any previously-declared members in
> the type.

Right, none of the metaprogramming proposals I've seen thus far
support exactly this. The mixin
must accept the type it's going to be mixed in as a parameter of some
kind. We don't have
'inline templates' where we can just explode code into a context, and
have the exploded code
expect certain declarations to be valid.

> 2: The ability for a type that gets mixed-into to access the mixin's
> declarations as if they were its own.

This is another aspect which is not that direct in the proposals I've seen.

> 3: The ability to convert a pointer/reference to a type into a
> pointer/reference to the mixin it uses, providing access only to the mixin's
> interface.

This is easy to do, just generate a conversion function or an operator.

With the proposed metaprogramming facilities, we can fairly easily
express "make type X behave like
type Y, without requiring an inheritance relationship". We can
generate delegation code. What we
don't have is "make the code in type Y behave differently depending on
its surrounding context, without
having any readiness for that in type Y".

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFk2RUakgF_ZAt81uhcwn4KzLcbjC04LpqyREHWoKNFe6njDfQ%40mail.gmail.com.

.
