220 33766 <omgfdk$pkv$1@blaine.gmane.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Bo Persson <bop@gmb.dk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: properties?
Date: Thu, 10 Aug 2017 04:12:12 +0200
Lines: 59
Approved: news@gmane.org
Message-ID: <omgfdk$pkv$1@blaine.gmane.org>
References: <6ed2bd55-5538-418f-8f1a-263a9958babd@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"; format=flowed
X-Trace: blaine.gmane.org 1502331160 914 195.159.176.226 (10 Aug 2017 02:12:40 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 10 Aug 2017 02:12:40 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.2.1
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCZ6RLW3UIKBBEMCV7GAKGQEZOWFS3Q@isocpp.org Thu Aug 10 04:12:36 2017
Return-path: <std-proposals+bncBCZ6RLW3UIKBBEMCV7GAKGQEZOWFS3Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wr0-f200.google.com ([209.85.128.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCZ6RLW3UIKBBEMCV7GAKGQEZOWFS3Q@isocpp.org>)
	id 1dfcxZ-00089b-Pm
	for gclcip-std-proposals@m.gmane.org; Thu, 10 Aug 2017 04:12:29 +0200
Original-Received: by mail-wr0-f200.google.com with SMTP id u89sf11061678wrc.1
        for <gclcip-std-proposals@m.gmane.org>; Wed, 09 Aug 2017 19:12:36 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1502331156; cv=pass;
        d=google.com; s=arc-20160816;
        b=VxFFMaKMdGOam6Wc2x6Rz3Ym7/cpv7nLySkG5el5TDtSlS5e+ezVxfeS4V8VVkIXwo
         /Q1xGCCDV/BR5vhKEz3x8BUARpEf3X9HbFnHHwSgwBwkYHNcT3dQmXVMcf42XFIex3Rr
         tNCQTgwEC9exmgbqMCK9+AwB+VshvyEIU3ovm5Ewdh6M58ve25Uk8m9LaKKzAt6dyVhj
         BACH0EitS5vZX9MaovG7yZD2kaG4XeIPdmUCONyU80cwb/nBxmzFlnD+Zxgf1retcYc7
         BeCOAcy11QBVhIugoXfq+C4sbsS62A29UzZIaOsMt0wmzXWzanN6XKQx4QwuiRhqFBPg
         RiEg==
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:content-language
         :in-reply-to:user-agent:mime-version:references:message-id:lines
         :date:subject:from:to:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=h9w/enSvvv4HE84no+F5aG6Icdmz3QoamR2hzuXYxzU=;
        b=dsR+tO5MxK7YIYBmAkcfVt5LhVB79pWcHC0d+o/jWG0SY1A+Pb5P7OXt7HwljQvzTB
         SP2ozRo3ougbMzzK82r33UOGY0oSjb00NWtpftm9xZZ5VomkiKW0I3zYF+1jFZGT9e2n
         HkbDc909wsZ4mKBwhySQ8yVMikYz3tjIBFOxTcKNES5Viz1WqsHm114wLr6u/Im0W7xU
         JN7dQ7+4eieuCdGl1dbjeZCyu3fVBs78ldgTH6T/YLcD0lNUMg9y+6Fvz1iDss97VJZG
         rj9kFeJjUujd5+793LgK6duHSlPescCGKJKAKyLJWP/KVP1EdpQw32GWUKAb/awHTZt6
         4qkQ 
ARC-Authentication-Results: i=2; mx.google.com;
       spf=neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=to:from:subject:date:lines:message-id:references:mime-version
         :user-agent:in-reply-to:content-language: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=h9w/enSvvv4HE84no+F5aG6Icdmz3QoamR2hzuXYxzU=;
        b=IqWqDDo2cqq+Sa5hN2K25+1J/FSqSyykuiXAzIWs3n920m0o9qEgL5sf/tPmJEtM4n
         td0k6fF8qLwVTN/vz4EWEBi7eR8L33GGERGjrEo/LkcttFUTSmimNtuLwj1UfCfRw0ja
         AR8iIlPbhfT7t0RSvwKnBCgIO6/ZTMdIrIDea6w8IwEbO5Fyxq9Caothy89tGOTn3Z8B
         Tw80hT5bupE5vX7CRkWLH71YSo09iW0A5GAIlKH3Rdsa1SiuEeXaqFmDgNLVNNwZVLy8
         wa963NwECRQqOB2LPWFK6TpyA+U6X19fB39vvwcWyAwUIzSf7W1AYgm7ScM3IQq5ht5f
         MeEg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:user-agent:in-reply-to:content-language
         :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=h9w/enSvvv4HE84no+F5aG6Icdmz3QoamR2hzuXYxzU=;
        b=PDe5wvE0pXM1Cd6pIAx15TxG+22P+ss4f4sHLEpAXmFDrT7gTQlXrtmlXNGBGpps6v
         Ik0RpK5ifyV5OcQlpebfNmLr7iMSsCPcjQrs14FUUczlrv06BSO/wnG7h4/ZfoYQKPf+
         W2Z+pyVDage5ilsOW+MeCNOCXnJzjIHMczq+T/ZnYXVPqs+y97R5Jspv3+pNdMSgkuoN
         02zVV+mdHhDoasHcCI2LfBr+n/291xTXPk87XN7nIGx6Zpe85k0GlhfwtOOnyD7svp1D
         pMfLjVolHMrm83nRvfCV5dJQ15ZDIYng0DkEzZTM8+1ixBVEgPpT4ZpZVomhr/gojG/B
     
X-Gm-Message-State: AHYfb5gykBl9Z64ocQ8WktK2o35kwfE9+GcmS6Z0Fuqn+FH6k+aPCtFG
	AlplvOp6E6ERpw==
X-Received: by 10.28.139.73 with SMTP id n70mr1177148wmd.1.1502331156028;
        Wed, 09 Aug 2017 19:12:36 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.46.78.18 with SMTP id c18ls916237ljb.51.gmail; Wed, 09 Aug
 2017 19:12:33 -0700 (PDT)
X-Received: by 10.25.145.23 with SMTP id t23mr3545272lfd.234.1502331153659;
        Wed, 09 Aug 2017 19:12:33 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1502331153; cv=none;
        d=google.com; s=arc-20160816;
        b=h6Q1amRWxUopScp22gbJ0E0/PQZBQgEscH5FsJj8uGBTWyOdImcm2601LUu6BYoIKq
         74Dmu1i704Jc3/t1yfKfunlYTaw6D/EPfz8jUQiZfb05uCXlP0T4M5djeWH4d5fqDWMj
         zq6x0PZ15asJ++l6PIj20etiflbnH1TVn4nfApQy7GLECUFr2u5NQcex2Drgk6ScN0UZ
         hD21oC1359G+pommQRDks2LCKOzXvOd2h3IxtiUlR6PXcu01ppYh9I4CfjFPnHFprky2
         L0gZlpqF2Frp2pCKw/PDkJxacDhS46pECAPK8b5xQPxlIcnV2J1HqbzWlgm9JB+XubcE
         29Xw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-language:in-reply-to:user-agent:content-transfer-encoding
         :mime-version:references:message-id:lines:date:subject:from:to
         :arc-authentication-results;
        bh=XqbP9EHfLdMQGT6SsAIKobAcmwKizzdLLZwbRLvUE9k=;
        b=CQbNvwayygZSZULUlayK5kGdsdSyN3hj80hfsPIQrBgXJbWKne6Ah7anlGhkPZcE8t
         tN2lLusKVKUMzM6wKA+BUIM3dtiwWs6/N6rvDweZP4ENmOmvDrIGWp0tYJf/Jffike2l
         X5/M9I+XlGOfUvBLRGryyxxNJ8oXvrjKnZ4jlem3it0bz5ywmz0+G2jZgG3VzIzIZY5u
         bJSJIslkdScldzZDKhwC4kXwSEmYij9FRg2vNhHmD+vCQ2g0ObazAh4SYOAyU1QsoN+g
         4QRv1cEhsgjD4sMn413e+OKODXUIaYpJUDq2lOVmFoyqwhBrRvfGISvEj1qvuCER9WUP
         I8qQ==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
Original-Received: from blaine.gmane.org ([195.159.176.226])
        by mx.google.com with ESMTPS id 66si2475391lfz.95.2017.08.09.19.12.33
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 09 Aug 2017 19:12:33 -0700 (PDT)
Received-SPF: neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) client-ip=195.159.176.226;
Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1dfcxO-0007XF-8A
	for std-proposals@isocpp.org; Thu, 10 Aug 2017 04:12:18 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 52
Original-X-Complaints-To: usenet@blaine.gmane.org
In-Reply-To: <6ed2bd55-5538-418f-8f1a-263a9958babd@isocpp.org>
Content-Language: sv
X-Original-Sender: gclcip-std-proposals@m.gmane.org
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 195.159.176.226 is neither permitted nor denied by best guess
 record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
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:33766
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33766>

On 2017-08-09 19:32, Evan Teran wrote:
> I never brought it up before because I assumed that it MUST have been 
> discussed in the past... 

Oh, yeah...

> 
> The idea being of course that this makes code such as the following valid:
> 
> |
>      T value;
>      value.data =10;
>      std::cout <<value.data <<"\n"
> |
>

This could already work if you just add () to each use of data.  :-)


> I can imagine a few benefits for properties:
> 
>  1. If we encourage the use of properties over named getters and
>     setters, then it makes long term maintenance of code simpler with
>     better API stability. We can write code initially just using public
>     member syntax if there is no need for special handling on reading or
>     writing of the member. If the need ever arises to have special
>     handling during read or write, then it the code only needs to change
>     in the class itself. The code which uses it need not change at all
>     (obvious exceptions involving taking the address of a member, but
>     taking the address of a property could just be a hard error since it
>     doesn't make much sense in the typical case).

A counter argument here is that adding "special handling", like 
validating the assigned value, IS an API change.

Adding LOTS of processing changes the runtime characteristics of the 
code, which could also be considered an API change.

>  2. Can replace a lot of uses of bifields which often result in
>     undefined or platform specific behaviors. A user could create
>     properties which represent each bit and can do the masking
>     themselves to ensure in a reliable way that the bits they intend to
>     work with are the ones which actually get used regardless of endian
>     issues.
> 

This offers a solution to a problem I have never had.



     Bo Persson


-- 
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/omgfdk%24pkv%241%40blaine.gmane.org.

.
