220 7596 <CAGsORuAspU5wOfv44_pDj01Nj9eVyWPUHYj73jJAqsNTXobx=Q@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Zhihao Yuan <zy@miator.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Fixing the private method issue
Date: Mon, 4 Nov 2013 15:36:29 -0500
Lines: 63
Approved: news@gmane.org
Message-ID: <CAGsORuAspU5wOfv44_pDj01Nj9eVyWPUHYj73jJAqsNTXobx=Q@mail.gmail.com>
References: <d5cd9fa5-ac2f-465b-b92d-cf2a35607245@isocpp.org>	<5eeafd6f-32f3-4281-9374-617af852fe21@isocpp.org>	<CAOfiQqkokv_B9JDrGGviBM3-yScSCMTjS5wMd49dQpwinPBiWA@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1383597388 1444 80.91.229.3 (4 Nov 2013 20:36:28 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 4 Nov 2013 20:36:28 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCSKRWMD4EHBBTUK4CJQKGQETN44MTQ@isocpp.org Mon Nov 04 21:36:34 2013
Return-path: <std-proposals+bncBCSKRWMD4EHBBTUK4CJQKGQETN44MTQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f200.google.com ([209.85.223.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCSKRWMD4EHBBTUK4CJQKGQETN44MTQ@isocpp.org>)
	id 1VdQsy-0008FX-7C
	for gclcip-std-proposals@m.gmane.org; Mon, 04 Nov 2013 21:36:32 +0100
Original-Received: by mail-ie0-f200.google.com with SMTP id aq17sf22974822iec.11
        for <gclcip-std-proposals@m.gmane.org>; Mon, 04 Nov 2013 12:36:31 -0800 (PST)
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:sender:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=fhqj+i5ul495b5fWvZRPguOlJhIpxCCIJY4rAIrlQqc=;
        b=D6Te5Wf0UDIISLeQMNvDcfa1t33ReVAYGQ196IkMyuZK8javGv2o2c9fZAsFMJ6Htr
         pvAiDzM0l5DItg7Eg5n/C58iF5Vv7yllrbVkgYopcr0HjcCih3thAhY/ntQUutQ9keu9
         BKJR0EhlRToHu0Qz2SoUloxsoUpXeqC7YQS/l0+BlhsLux4DjeuRbJRjaz2Kfw6HZ9t8
         mechjrl4RlsbOhRGkptqHBfXLRjwzVNRJsk4CesUxOBtrMVIl9PaAWnutiCWB2SrRY51
         hYZgy3q4iwqpxqYO1eU3qc1jhi5TiVgW65k+A3EDiMvh/PZ5QermYUV5ZhFXRYIspNbU
         TH0g==
X-Gm-Message-State: ALoCoQmnpmY+u2gArqcuE4e4eOmhH+kFB4jN0i0xR8ryw2aMIxTd5TT8a2iEWqZfMfP4a8EFyNZO
X-Received: by 10.43.101.133 with SMTP id da5mr5076585icc.20.1383597391261;
        Mon, 04 Nov 2013 12:36:31 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.117.69 with SMTP id kc5ls2445844qeb.42.gmail; Mon, 04 Nov
 2013 12:36:30 -0800 (PST)
X-Received: by 10.236.142.210 with SMTP id i58mr15303233yhj.33.1383597390274;
        Mon, 04 Nov 2013 12:36:30 -0800 (PST)
Original-Received: from mail-s68.mailgun.info (mail-s68.mailgun.info. [184.173.153.196])
        by mx.google.com with ESMTP id c66si6267255yhm.80.2013.11.04.12.36.30
        for <std-proposals@isocpp.org>;
        Mon, 04 Nov 2013 12:36:30 -0800 (PST)
Received-SPF: pass (google.com: domain of bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates 184.173.153.196 as permitted sender) client-ip=184.173.153.196;
Original-Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com
 [209.85.128.173]) by mxa.mailgun.org with ESMTP id
 5278054d.7fe06a3481b0-in3; Mon, 04 Nov 2013 20:36:29 -0000 (UTC)
Original-Received: by mail-ve0-f173.google.com with SMTP id jw12so1835143veb.18 for
 <std-proposals@isocpp.org>; Mon, 04 Nov 2013 12:36:29 -0800 (PST)
X-Received: by 10.58.201.234 with SMTP id kd10mr83892vec.32.1383597389218;
 Mon, 04 Nov 2013 12:36:29 -0800 (PST)
Original-Received: by 10.220.250.6 with HTTP; Mon, 4 Nov 2013 12:36:29 -0800 (PST)
In-Reply-To: <CAOfiQqkokv_B9JDrGGviBM3-yScSCMTjS5wMd49dQpwinPBiWA@mail.gmail.com>
X-Mailgun-Sid: WyI3MTBkYiIsICJzdGQtcHJvcG9zYWxzQGlzb2NwcC5vcmciLCAiNjkxMTAiXQ==
Original-Sender: zy@miator.net
X-Original-Sender: zy@miator.net
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates
 184.173.153.196 as permitted sender) smtp.mail=bounce+3f9131.69110-std-proposals=isocpp.org@miator.net;
       dkim=pass header.i=@miator.net
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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:7596
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7596>

On Mon, Nov 4, 2013 at 1:01 PM, Richard Smith <richard@metafoo.co.uk> wrote:
>> //foo.cc:
>>
>> class Foo namespace {
>
>
> "class X namespace" looks a lot like "allow me to violate access control
> here, please".

I don't think so.  This scope, afaics, is private, with contents safe
to be added without changing the ABI.

> But since we're brainstorming here, we can get most of the benefit here with
> extension methods alone:
>
> // foo.h
> class Foo {
> public:
>   void doWork();
> private:
>   int _f;
>   friend struct FooImpl;
> };
>
> // foo.cc
> struct FooImpl {
>   static void doWorkHelper(Foo *this) {
>     doSomethingWith(_f);
>   }
> };
>
> void Foo::doWork() {
>   doWorkHelper();
> }

I see two problems here:

 1. Program is written for human to read.  This approach, with
    functions taking pointer to objects, basically reverted C++ to C;

 2. Friend is flawed: what you need is to grant accessibility to
    a set of functions, but what you do is to grant accessibility to
    another class scope.  I read this as another "solution from
    implementation's view" like using private to make a class
    non-copyable.

There should be more simple, more obvious answer to the problem
raise in this thread.

-- 
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://4bsd.biz/

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.
