220 39987 <35f836e7-f7af-e36f-e5f4-2be447d65576@westcontrol.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: David Brown <david@westcontrol.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Named Parameters for C++
Date: Thu, 23 Aug 2018 19:17:00 +0200
Lines: 81
Approved: news@gmane.org
Message-ID: <35f836e7-f7af-e36f-e5f4-2be447d65576@westcontrol.com>
References: <CAPuuy5eBx1ybcPjS6dNsk7n1_c2uhdRBS19qr=q5cj3cTURnLQ@mail.gmail.com>
 <pl3ogk$csr$1@blaine.gmane.org>
 <f3af9e48-f865-476e-8724-4af19ce23369@isocpp.org>
 <pl671k$gsb$1@blaine.gmane.org>
 <823c098a-0fb0-18c3-82f3-e8a8616312f1@gmail.com>
 <pl6vh8$kta$1@blaine.gmane.org>
 <2755b639-002d-a94b-a3d4-3a0197259cda@gmail.com>
 <1585ccdc-7057-d8df-a31b-cf9f7de9a6dd@westcontrol.com>
 <54e34f7c-f32b-a912-5229-240f855c9fad@gmail.com>
 <5dde96f3-24bc-0499-8019-eb8195bdaded@westcontrol.com>
 <d1905217-f914-6076-55a2-6b92b1880ed9@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
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1535044498 29841 195.159.176.226 (23 Aug 2018 17:14:58 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 23 Aug 2018 17:14:58 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
To: Matthew Woehlke <mwoehlke.floss@gmail.com>, <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDP6R2XHXIARBD6Y7PNQKGQEA6K4QDI@isocpp.org Thu Aug 23 19:14:54 2018
Return-path: <std-proposals+bncBDP6R2XHXIARBD6Y7PNQKGQEA6K4QDI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lj1-f199.google.com ([209.85.208.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDP6R2XHXIARBD6Y7PNQKGQEA6K4QDI@isocpp.org>)
	id 1fstC9-0007cb-HY
	for gclcip-std-proposals@m.gmane.org; Thu, 23 Aug 2018 19:14:53 +0200
Original-Received: by mail-lj1-f199.google.com with SMTP id e12-v6sf653507ljk.3
        for <gclcip-std-proposals@m.gmane.org>; Thu, 23 Aug 2018 10:17:04 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1535044623; cv=pass;
        d=google.com; s=arc-20160816;
        b=MtREc/qKQz87JQ4ssCOrCfDFfuuNYFZpLixWmvBvzmz9xNyTJTtsj4IOLSpqEFN7GB
         lwQAMUCB8HiV9pulJinaO2ns3KiHoW3LkUE9OIa3MmHS4C/hPrANlOEHd6nvL5VRPAyF
         kkKtx02a/PpybIiVTOOPyiMYO78VZW6VAppy0XfEMOAN0Qp1f13GRZy4SIuNu6w5L1M7
         BFeJ2a9+YYDRBOgjWI0Ofu04Vy/QVaepKn3Zi9kUG/1RM9yp0Q+36dexknRU0bZExpwc
         jiZ3IAjs0OpBQ3A9IA9Y179OSKlLhkL7lGrv8fw3tN0Y1ztMHWYiRaAN7Q0Xi1gGPuRo
         JzWA==
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-transfer-encoding
         :content-language:in-reply-to:mime-version:user-agent:date
         :message-id:from:references:to:subject:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=uSNogbb3wF2ohvegwgTjLZPP9/3/j95jiGDcsIOvKqA=;
        b=e076Ju36lv5yOneqt1/5y/bIfa05N7QCMCi/x3qz97DjQsnI1EsJo3tdExLSUzd4zZ
         tXLKiw31Dbk0GzpOYkBVwhuxV1eJBPNtgp9JuM5imaCgj4SRNmdfydIcaNZZBXDfHCkC
         9VrFkZ5wDDlHKdwY9nwkEx3hdo954h9q3hn5o/1jULkIS+CeQBUevuIkAPZE9H1dvVtQ
         i2zLsZTFSIii3jAs6FXDBOdLgX3q6fDibmKdsKJQ7LnBmHJnE90jkMHmFeBm6SmFb3Y6
         mYm4WDNs6rZqp5RaFTmUO06gsZhdhZkAdh0IRAlFAn1ENHPQY16J1bskdgtAIs 
ARC-Authentication-Results: i=2; mx.google.com;
       spf=pass (google.com: domain of david@westcontrol.com designates 213.162.250.23 as permitted sender) smtp.mailfrom=david@westcontrol.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-language:content-transfer-encoding
         :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=uSNogbb3wF2ohvegwgTjLZPP9/3/j95jiGDcsIOvKqA=;
        b=1i6Nt+684fZn/90RgpAqoDDNxXj30oL2WkWzdTAFrTa+kqp0CBEh9mgMrZeD32isus
         ToU0kWOl4TSGzqZBx39ug47qigVFcubWOE4m+80MRwICUmuRHhmM1VO8ITLGbk3ma2MH
         sgp3j+ihu4+KiNcZHJir856+xRFB2abL96LIfCg3Ynsv+jnDrOwOYNZz0PdEwl9h6by9
         mUQksCpavvfmx0mWT4IPr+DrXMlYjp2zYQY6pBZrD61sNcYyJNJhZPuk+lkLf3DJ2BWn
         jwgabr0Z2x1OhLvJK/wRYeLv7JzmmMOlprF4s+BAIrb/KAVOWhqLrT8IrGDD3AvE0iti
         LwZ 
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-language
         :content-transfer-encoding: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=uSNogbb3wF2ohvegwgTjLZPP9/3/j95jiGDcsIOvKqA=;
        b=CWjUtVRw+CFheW9DHpUfjJFoGsJb+r8UredvuQLgIvIf4OoQpmRrvLsyp8GZPy/X1j
         apAFbuQwjZH4I+1VTSFW1cGHXlkNKHhMn5CaqKnvTup60S3cxfbWZgo1vs+vNJHMLzWz
         Wdy+QleZt93tcbdPBElz+882Z7MWuNiYFx5udf5ntx0FB14DNYWp2FGzQrVddWVK1RG0
         v9drITrnI//qx2R3YmUmQQZiPRqNi325zfwy94fc353qUzV8XHuhunemeWThfsgOkz4+
         d52PzNzkRcn64e6/c6acl6b5FxWU3psiymgMbE7tm6O 
X-Gm-Message-State: AOUpUlGt8+4dfFsEIPAoOD4RIWFHhuwcOjKFgVG9RYjCtOB4kac+lg8p
	UgrWnmWIKW5EPnvKXzblzPnwkg==
X-Google-Smtp-Source: AA+uWPy8WeVkFoSbybljebHUeGbhv3LISVrxIadP6tkIFW5YkqCHoY3WwdUXavCfE+bjPnbUbkpubA==
X-Received: by 2002:a2e:95ce:: with SMTP id y14-v6mr2710878ljh.12.1535044623891;
        Thu, 23 Aug 2018 10:17:03 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a19:cdd2:: with SMTP id d201-v6ls290039lfg.30.gmail; Thu, 23
 Aug 2018 10:17:02 -0700 (PDT)
X-Received: by 2002:a19:cb93:: with SMTP id b141-v6mr20225100lfg.119.1535044622765;
        Thu, 23 Aug 2018 10:17:02 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1535044622; cv=none;
        d=google.com; s=arc-20160816;
        b=mQVxlriPBx3dv4r3TgB1Tr7RX7sJfIF2X2asO4PEOQwIo7QXJdfmZzH3VWV8EUkY6l
         nVLEaJdekSlENyDnzazxB5eAnz4j+usket4mb7LKvhQG14v+dnngMIuqfrpXt3GSoNxx
         K2ziWYOp+2Pa97SjAEzjbqodlZPfIjVSLGPLNWdAgGiHQy0wVt8/2+rekIy8DtXZwtgJ
         ospfq/7OIvV4iFjo0DEJyhxmXmvgmfieNnVn+idAlQhvXo8ASej7pWFNrETiOVY3FtM4
         YVYKQxCXRD8ElOcTfcGf8aswUyL6ZVaoqy9dkyxGaZQCkBj5pMIstmgNu8BCrt7kS5Zj
         iKag==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:in-reply-to:mime-version
         :user-agent:date:message-id:from:references:to:subject
         :arc-authentication-results;
        bh=V82/zYhpRcmV/CXcdhkN4xJOJInhZ+0IxnyQ/fK5Dow=;
        b=IDqQQ9g7c6RBGcjGWujVicdGCTeCQxHgJOQyz8oBVSjt+yXcfO76OX5xOPetcbCUxa
         uU1VDJ3yxAzP8P2lLqT7fZkbql0UOUUcQiYGNgzD1cfXN84pyTv7fel3YrF1rJhkdKQy
         5uJuj4CQ5vH/h4bv8RUzkLg34S4hlWHDysHUPe1ZZ1yr/Dw67ZgO3YOnRaM/0K4GjzkZ
         xFZCBxUFW6gRb2N3zn/4NOBaKLNfFTVi5qwQUMO7W0ylKQ5Zno2YmISyVuoRgVAvmYN/
         RRVxKANjVGgjZRS94n+bPUKrHqmMvyKLLhXbmHvSJzjcztyIgDAuli3DlLdVRxnL5KqM
         wXHw==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of david@westcontrol.com designates 213.162.250.23 as permitted sender) smtp.mailfrom=david@westcontrol.com
Original-Received: from mailfilter04.hatteland.com (mailfilter04.hatteland.com. [213.162.250.23])
        by mx.google.com with ESMTPS id v10-v6si2435610ljj.391.2018.08.23.10.17.02
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 23 Aug 2018 10:17:02 -0700 (PDT)
Received-SPF: pass (google.com: domain of david@westcontrol.com designates 213.162.250.23 as permitted sender) client-ip=213.162.250.23;
Original-Received: from localhost (localhost [127.0.0.1])
	by mailfilter04.hatteland.com (Postfix) with ESMTP id F2E91102C4D;
	Thu, 23 Aug 2018 19:17:01 +0200 (CEST)
X-Virus-Scanned: by SpamTitan at hatteland.com
Original-Received: from mailfilter04.hatteland.com (localhost [127.0.0.1])
	by mailfilter04.hatteland.com (Postfix) with ESMTP id 53545102C3A;
	Thu, 23 Aug 2018 19:17:01 +0200 (CEST)
Original-Received: from JHSVMHUB02.netsentral.no (unknown [172.21.1.26])
	(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mailfilter04.hatteland.com (Postfix) with ESMTPS id 50ECC102C1D;
	Thu, 23 Aug 2018 19:17:01 +0200 (CEST)
Original-Received: from [192.168.4.245] (172.21.20.100) by e2010.hatteland.com
 (172.21.1.26) with Microsoft SMTP Server (TLS) id 14.3.224.2; Thu, 23 Aug
 2018 19:17:02 +0200
In-Reply-To: <d1905217-f914-6076-55a2-6b92b1880ed9@gmail.com>
Content-Language: en-GB
X-Originating-IP: [172.21.20.100]
X-Original-Sender: david@westcontrol.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of david@westcontrol.com designates 213.162.250.23 as permitted
 sender) smtp.mailfrom=david@westcontrol.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: 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:39987
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/39987>



On 23/08/18 18:44, Matthew Woehlke wrote:
> On 2018-08-19 07:23, David Brown wrote:
>> here I am talking about the optional use of parameter names to improve
>> readability, help write correct code, help spot incorrect code, and -
>> optionally - to allow re-arranging of parameter order and skipping
>> defaults using names.
>=20
> If we *don't* get the optional parts (skipping, reordering)... then
> what's the point?
>=20
> If we don't get the optional parts, you might as well modify your
> compiler to warn you about:
>=20
>    void foo(int x);
>    foo(/*y=3D*/5); // warning: 'y' !=3D 'x'
>=20
> ...and no language change is required.

I see two disadvantages of that.  One is that it is seriously ugly=20
having comments in the middle of a function call - "foo(.y =3D 5)" is very=
=20
much nicer and neater syntax.  The other is that because there is no=20
standard, and neither limits nor requirements in what you might have in=20
these comments (maybe someone wants to write "foo( /* was 4 in last=20
version */ 5);", it would be hard to get it in common use.

But as far as I see it, it is this checking that is the most important=20
feature.  It covers the two most vital points - it aids readability and=20
clarity of the code, and it means mistakes are more likely to be caught=20
at compile-time.  These are both /good/ things - and IMHO they are worth=20
allowing the syntax "foo(.y =3D 5);" even if you don't get anything else.

(I'd like to see that same syntax in C as well, including calling C=20
functions from C++ - and I think re-ordering and overloading would not=20
be a consideration for C.)

>=20
>> There are two other use-cases where there could be debate about the best
>> solution:
>>
>> If the call has the right parameter names, but the wrong order, should
>> that be a warning, or error, or should the compiler "magically" correct
>> the order?=C2=A0 If strong naming is used, the compiler should certainly=
 be
>> able to re-order the parameters without giving any complaints.
>=20
> Honestly, this is a good question. There are arguments on both sides
> whether or not to allow reordering, and I am somewhat avoiding taking a
> stance.
>=20

I have some rough preferences here - but I freely admit that I don't=20
have the experience at guessing what the complications might be, and I=20
leave it to the experts to see if the stance is forced by issues that I=20
have not thought about.

> That said, FWIW I think I'm less okay with reordering weak names than
> strong names.
>=20
>> The other case is for skipping arguments.=C2=A0 Again, with strong namin=
g
>> this should be supported.=C2=A0 I believe it /could/ be supported fine w=
ith
>> weak naming, but would again be okay with the safer solution of not
>> allowing it without strong naming.
>=20
> Agreed. (Skipping is sort of a "weak" form of reordering.)
>=20

--=20
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 e=
mail 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/35f836e7-f7af-e36f-e5f4-2be447d65576%40westcontr=
ol.com.

.
