220 27592 <nnv12b$okq$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: this in non-member functions
Date: Thu, 4 Aug 2016 11:14:50 +0200
Lines: 49
Approved: news@gmane.org
Message-ID: <nnv12b$okq$1@blaine.gmane.org>
References: <CAA7YVg3ObHqk-rfGRqgCqw3D-=u2pOwz=p8NHtC6n9tpBLq-Aw@mail.gmail.com>
 <cf5b6196-63bc-49ff-8a6a-bfdfb8a7ab0e@isocpp.org>
 <CAA7YVg2BQaVD2MyLyyEWuzWUnqjGrNUUi9eZwy7skjq8=ourvA@mail.gmail.com>
 <2351486.cE391vEbrj@tjmaciei-mobl1>
 <CACGiwhEAN4R2xE9g84xk6KKDB76+PpLFUt_Af6aKhDpAMf8Lqw@mail.gmail.com>
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 1470302118 4580 195.159.176.226 (4 Aug 2016 09:15:18 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 4 Aug 2016 09:15:18 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101
 Thunderbird/45.2.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCZ6RLW3UIKBBG4PRS6QKGQEQ2BYYAI@isocpp.org Thu Aug 04 11:15:10 2016
Return-path: <std-proposals+bncBCZ6RLW3UIKBBG4PRS6QKGQEQ2BYYAI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f72.google.com ([74.125.82.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCZ6RLW3UIKBBG4PRS6QKGQEQ2BYYAI@isocpp.org>)
	id 1bVEk8-0000GU-41
	for gclcip-std-proposals@m.gmane.org; Thu, 04 Aug 2016 11:15:08 +0200
Original-Received: by mail-wm0-f72.google.com with SMTP id l4sf142112173wml.0
        for <gclcip-std-proposals@m.gmane.org>; Thu, 04 Aug 2016 02:15:08 -0700 (PDT)
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: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=GSQ7sQavcT60869JSeb6buo4TKg6X7myRfox3MlxOak=;
        b=kJrLgnNdBynYXZF6i7sJr5Ie2V8hmUgfJLpC3sMJxSPbyMZH3em/rRCUz6Bg/S7pOg
         sMqThUzWswifagDfotahc7+mlRwcIelHy60UD+IdMI9+q2CFDf16CKTqCvLq99Biy8lO
         BhWm0ldcMY8yQeCgMlyOA5RTd2l+nWrZGg7mv+jK9W3QYjWC5T0nx5XrZ9KyyC3aN7w2
         atuMCrzr7HNwTpc+1DXbXbJZl4q/34ml0CzA6pcMf5Fa5P8PQp99zszPG9o64wbjj2PC
         JRM2Te7Fd9B96wJrh2jGBTAePhMTsCbmjyo2y4sE16cj0PjSWTvAJh5gHR0uZmpCnCVJ
         0AWg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:user-agent:in-reply-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=GSQ7sQavcT60869JSeb6buo4TKg6X7myRfox3MlxOak=;
        b=TPal6YcIBR4Jq608ogN+JKtWzS6f7YEGzXCdPTrjCiAjkHM9a/Q8gc9YBrnexCJ/BB
         qarU1lC3NxVK5i+66/iHsLqhqmll7uNcBo3n/H4Q+LYjdF9dqJnBQhCBlLz/3RP79jXh
         QWsNryryASlGct9NQXhctReztgg9JlJ+BQQN5D2ECMopPyI6i879bAfbCjbdYjK77x53
         St5xAM0S+e6XfVTqA/I9SCPlWc9kDS//rjzm2TW9ZndlOW9MNHyTh5DPlW2SPD4BuTgH
         7dGuGKuFYK0AerLRBIMMghAvUn/vs3rHGePgTw9fV9EpZ9A2LJ1hv/gZqKIJnB7HV7Z+
         LReQ==
X-Gm-Message-State: AEkoout03ZruKb9uzedVBypKpWcqamWTs3QaoYJUuF0rcWhkrJZ4GCNHA9ZBpQFpPPDVNg==
X-Received: by 10.46.0.16 with SMTP id 16mr9830098lja.9.1470302108347;
        Thu, 04 Aug 2016 02:15:08 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.46.32.16 with SMTP id g16ls188663ljg.48.gmail; Thu, 04 Aug
 2016 02:15:07 -0700 (PDT)
X-Received: by 10.25.157.146 with SMTP id g140mr19203931lfe.172.1470302106998;
        Thu, 04 Aug 2016 02:15:06 -0700 (PDT)
Original-Received: from blaine.gmane.org ([195.159.176.226])
        by mx.google.com with ESMTPS id t14si5234356lfd.114.2016.08.04.02.15.06
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 04 Aug 2016 02:15:06 -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 1bVEk4-00081p-69
	for std-proposals@isocpp.org; Thu, 04 Aug 2016 11:15:04 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 42
Original-X-Complaints-To: usenet@blaine.gmane.org
In-Reply-To: <CACGiwhEAN4R2xE9g84xk6KKDB76+PpLFUt_Af6aKhDpAMf8Lqw@mail.gmail.com>
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:27592
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/27592>

On 2016-08-04 10:49, D. B. wrote:
> On Wed, Aug 3, 2016 at 10:04 PM, Thiago Macieira <thiago@macieira.org
> <mailto:thiago@macieira.org>> wrote:
>
>     On quarta-feira, 3 de agosto de 2016 14:37:14 PDT Viacheslav Usov wrote:
>     > void foo(A *this) { x = 1; }
>     >
>     > is equivalent to
>     >
>     > void foo(A *ptr) { ptr->x = 1; }
>
>     Understood, but is this the only benefit? Is it worth the hassle for
>     saving a
>     few keystrokes?
>
>     Also note that it's not a member function, so it can't access
>     protecteds and
>     privates of the object.
>
>
> Agreed on both counts. Especially the latter, which hadn't occurred to
> me yet - but I think is just another of the inconsistencies/ambiguities
> I alluded to between 'this as object' and 'this as shortcut'. Whether or
> not other refinements were made to resolve all of those, I think it's
> guaranteed that a lot of people would end up confused...
>

Yes, I would definitely be confused by the sublety of the parameter name.

int   x;

void foo(A* this) { x = 1; }   // x is A::x

void foo(B* that) { x = 1; }   // which x is it now?

void foo(C* htis) { x = 1; }   // typo or intentional?



     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/nnv12b%24okq%241%40blaine.gmane.org.

.
