220 39036 <41949fb9-c3b6-4d16-a760-2d9064bce683@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: mihailnajdenov@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Strong named arguments as tag overloads
Date: Mon, 9 Jul 2018 11:56:27 -0700 (PDT)
Lines: 546
Approved: news@gmane.org
Message-ID: <41949fb9-c3b6-4d16-a760-2d9064bce683@isocpp.org>
References: <45cdc03c-1370-4ac3-a8ff-334dcc8884b3@isocpp.org>
 <CALvx3hZODTkduJ61OoOofpX21J_-1zAN1rw5PHAmLtg6PmDtvQ@mail.gmail.com> <da3e4418-e043-4ad4-bab4-513ddd633abe@isocpp.org>
 <CALvx3hbKvCUMGE5cr60Zu90Fia-ngcuwg2j+0zRTBSNzqupimA@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_110958_324298937.1531162588126"
X-Trace: blaine.gmane.org 1531162471 21248 195.159.176.226 (9 Jul 2018 18:54:31 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 9 Jul 2018 18:54:31 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCUJ3A7GRAPRBXO7R3NAKGQERYTRPYY@isocpp.org Mon Jul 09 20:54:27 2018
Return-path: <std-proposals+bncBCUJ3A7GRAPRBXO7R3NAKGQERYTRPYY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f198.google.com ([209.85.161.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUJ3A7GRAPRBXO7R3NAKGQERYTRPYY@isocpp.org>)
	id 1fcbIm-0005Ml-Mi
	for gclcip-std-proposals@m.gmane.org; Mon, 09 Jul 2018 20:54:25 +0200
Original-Received: by mail-yw0-f198.google.com with SMTP id c11-v6sf20304122ywb.0
        for <gclcip-std-proposals@m.gmane.org>; Mon, 09 Jul 2018 11:56:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=SSozHCnZ47dgg+OhQOllMO1QAv6/Es62fq7RpKKqJSw=;
        b=0yT2bIxNxWGnA1wZi0lwkfe6DqgSjeazosFKnRqIThYTcpHiEd1ACKWlUwZgcoHc51
         LakJ9tJWBXnYsjZnYe6VhFkLLRPg/bDVPksJCGPpJq/A+7p4lUkRS5J+PdOHhtOkHmvn
         mfaRTdypW2FJxgUGSXK9m04DDykpPRKMqcZ6uXE9y5jh5AlcSZ/wsgBcpBHPqYxPBF30
         qdPIMJW/lktpGKKMWZLXevJJoofnIcmDrutJOkBPz5Qa4hSXmp+07/gI58Gi4ko1nKNX
         Rd54fsMVvEatxdLYrG1gBrDwUpc3qyp4zWEQ10pJupODf11pFqAXhYhKxpjWagelh8xk
         WlMg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=SSozHCnZ47dgg+OhQOllMO1QAv6/Es62fq7RpKKqJSw=;
        b=LERwD0/Sk5/ae4UO5FhVlfNO9A9kw8HS3XsN3Sdc9KLcz3UnTbYpdZWLwJYOhhGK4T
         aXRluo0iTw+2VrXQg59Vl/9gri2Xzl0g7o9x1KzsK5K2VorG66qA5F8dGx6WOfp2EHmQ
         dsiRZHv+vYvM7rieH6reVysyEuJnllo+2k077om7+qjVAqCv7NIjewJfPRIPrfpo80Dx
         KFEvYNW3yhxsyAZiHN5TeuQt/RWgtdjfcCbO0MnDdSQWcPCiO3E7YQTF0yA1lixoJKJX
         50qXLu5SlUyRGtVXWdzf657GOmmXOoAqUPjfdEqxNAj9v0ULHbRnzAgdqOzYE/Ezo7FL
         hqwQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=SSozHCnZ47dgg+OhQOllMO1QAv6/Es62fq7RpKKqJSw=;
        b=drasr9cLtLKT21eo9ze8/S2/zdkjx+/Dwe6RQlHE6L/yYvyou90Q1x6mXHh+wD9b15
         kgoWGX1dX2wps5IgVvX0j91YqmcDJBRCw7O6AKONLqiHI0/9+G0w8iD0LpWdM8F/Tmd9
         7GCI3xBCsO9vAVN9LUqfSS6sDj/luDgEsSpBRoku3q586Vu9vqpEz+j3OQmsjIQ9ugQv
         OieBvRq1meo9+rW/fSp4Pj3OXRqVX/fi8i64MZ+3ayYMmd5pzduaHVhGf8ys32CP0kmF
         jEXqQFhN7NLolMZCba2ZTS0XvWn+EIdMnApN46Ceb8nAniBFCM70F8aPWW1DpJE//e1M
         jOjQ==
X-Gm-Message-State: APt69E3Q2ZCx86HFXDn6c7RQj3rWp0cbVsPOe+kgaSIrRJaKuR4hUlbt
	gWu+LJ28Nn+Y3gmDzWy8tnd1fQ==
X-Google-Smtp-Source: AAOMgpcEooA65ra+6bg/XwaxGPdzlei+lyXknIzr4k9682MYi9fV5RV9XG/mCo8CvgpmvIMNfI8J1A==
X-Received: by 2002:a81:218b:: with SMTP id h133-v6mr6009306ywh.17.1531162595432;
        Mon, 09 Jul 2018 11:56:35 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a81:1481:: with SMTP id 123-v6ls2231984ywu.17.gmail; Mon, 09
 Jul 2018 11:56:28 -0700 (PDT)
X-Received: by 2002:a81:330a:: with SMTP id z10-v6mr2754832ywz.5.1531162588669;
        Mon, 09 Jul 2018 11:56:28 -0700 (PDT)
In-Reply-To: <CALvx3hbKvCUMGE5cr60Zu90Fia-ngcuwg2j+0zRTBSNzqupimA@mail.gmail.com>
X-Original-Sender: MihailNajdenov@gmail.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:39036
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/39036>

------=_Part_110958_324298937.1531162588126
Content-Type: multipart/alternative; 
	boundary="----=_Part_110959_1408536446.1531162588127"

------=_Part_110959_1408536446.1531162588127
Content-Type: text/plain; charset="UTF-8"



On Monday, July 9, 2018 at 4:03:35 PM UTC+3, Richard Hodges wrote:
>
>
>
> On Mon, 9 Jul 2018 at 14:03, <mihailn...@gmail.com <javascript:>> wrote:
>
>>
>>
>> On Monday, July 9, 2018 at 1:38:12 PM UTC+3, Richard Hodges wrote:
>>>
>>>
>>>
>>> On Mon, 9 Jul 2018 at 12:01, <mihailn...@gmail.com> wrote:
>>>
>>>>
>>>> I got an idea this morning, here it is in code
>>>>
>>>>
>>>> void func(  width: int val );
>>>> void func(  height: int val );
>>>>
>>>
>>> Starting to look a lot like objective-c's loathsome syntax.
>>>
>>> We can already do:
>>>
>>> void func(height val);
>>> void func(width val);
>>>
>>> Where
>>>
>>> using height = tagged_value<struct height_tag, int>;
>>> template<typename Tag> struct tagged_value { .. implement in terms of 
>>> services expressed by the tag... };
>>>
>>>  Which is IMHO more expressive.
>>>
>>> An existing (very complete) model of this: 
>>> https://www.boost.org/doc/libs/1_67_0/doc/html/boost_units.html
>>>
>>
>> This can't handle nearly enough cases and is much more intrusive to the 
>> function - val is now a different type, this leaks into the implementation 
>> as well
>>
>
>  

> Different semantic meaning == different type is a *good thing* as it 
> allows relationships and operations to be checked at compile time. That 
> means fewer bugs. 
>  
>
>>
>> Also consider 
>> Rect(center: Point c, Size size);
>> Rect(topLeft: Point tl, Size size);
>> Rect(bottomLeft: Point bl, Size size);
>>
>> Semantically some BottomLeftPointType is just wrong
>>
>
> It's only wrong if the behaviour of a bottom-left point is different to 
> the behaviour of a top-left point. If it's not, then why bother tagging?
>

The user must say what point he is supplying so the ctor can fill the rest 
by using size. 

Rect({0, 0}, {10, 12}) // top:0 left:0 bottom: 12 right:10

Rect(center: {0, 0}, {10, 12}) // top:-5 left:-6 bottom: 5 right: 6

 The points are the same, making them different type is wrong semantically 
as you probably agree.

 
>
>>
>>
>> In general very often we want *both* the old types and the old function 
>> name, but to have a different implementation (to do something different). 
>>
>> This is why tags are so great and this suggestion is just an extension of 
>> that, the same way structured binding are syntax sugar for the returned 
>> struct.
>>
>>
>> More real word examples (slightly modified)
>>
>> QImage(serializedData: const uchar *data, int size, const char *format = 
>> {}); 
>>
>
> QImage(ByteBuffer const&, FormatString const&);    // semantically 
> meaningful, 1 fewer arguments, fewer errors
>


This still does not work - ByteBuffer can be raw pixel data or can be 
compressed (Jpeg) and the format can be omitted. We must introduce 
SerializedByteBuffer. 

Note that I agree with you in principal, but new type can be redundant (if 
used just in one place) or it might not scale - there might be dozens 
overloads
 

>
>
>> QByteArray(base64: const QByteArray& val);
>> QByteArray(percentEncoded: const QByteArray& val, char percent = '%')
>>
>> QByteArray(parseNumber: int val); 
>> QByteArray(parseNumber: double val);
>>
>> Note the last two in particular - special type will be  *completely* 
>> redundant - parseDoubleNumber{5} or something like that.
>>
>
> template<class Numeric> struct parse_number { ... };
> QByteArray(parse_number(5));    //c++17 template type deduction yields 
> parse_number<int>
> QByteArray(parse_number(5.0));  //c++17 template type deduction yields 
> parse_number<double>
>

This is confusing as it looks like we create a byte array by a function (or 
functor) and pass it to the a ctor.
It also leaks detail into the implementation - we must code in terms of 
some odd parse_number argument. 

This is just a workaround, not something semantically better (as arguably 
the Buffer example)


In general named params are The Right Solution if the types must 
semantically stay the same (incl. in the implementation) - Points, numbers, 
but often strings, images.


   - First, middle, last name should not be a different type (well depends 
   on the language, but you get the idea). 
   - Window title icon and window tray icon should not be a different type.
   - Header text should not be different type then Footer text
   - Tooltip and status text are the same type of string
   - 16x16, 24x24, 32x32 etc in a icon class are the same type - an image
   
Honestly, the list is long, we just don't notice it as we learned to get 
around of it in one form or another,
modeling our interfaces around the issues or simply dropping useful 
interfaces as they are hard or cumbersome to express .
 

>
>
>  There was a great CppCon talk on this. It's worth seeking out.
>
>>
>>
>>
>> -- 
>> 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-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-4ad4-bab4-513ddd633abe%40isocpp.org 
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-4ad4-bab4-513ddd633abe%40isocpp.org?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/41949fb9-c3b6-4d16-a760-2d9064bce683%40isocpp.org.

------=_Part_110959_1408536446.1531162588127
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Monday, July 9, 2018 at 4:03:35 PM UTC+3, Richa=
rd Hodges wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"lt=
r"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon, 9 Jul 2018 a=
t 14:03, &lt;<a onmousedown=3D"this.href=3D&#39;javascript:&#39;;return tru=
e;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;" href=3D"java=
script:" target=3D"_blank" rel=3D"nofollow" gdf-obfuscated-mailto=3D"JBQ1R_=
HHBQAJ">mihailn...@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"g=
mail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-l=
eft:1ex"><div dir=3D"ltr"><br><br>On Monday, July 9, 2018 at 1:38:12 PM UTC=
+3, Richard Hodges wrote:<blockquote class=3D"gmail_quote" style=3D"margin:=
0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon, 9 Jul =
2018 at 12:01, &lt;<a rel=3D"nofollow">mihailn...@gmail.com</a>&gt; wrote:<=
br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"=
><div><br></div><div>I got an idea this morning, here it is in code</div><d=
iv><br></div><div><font face=3D"courier new,monospace"><br></font></div><di=
v><font face=3D"courier new,monospace">void func(=C2=A0 width: int val );<b=
r>void func(=C2=A0 height: int val );</font></div></div></blockquote><div><=
br></div><div>Starting to look a lot like objective-c&#39;s=C2=A0<span styl=
e=3D"font-size:small;background-color:rgb(255,255,255);float:none;display:i=
nline">loathsome<span>=C2=A0<wbr>syntax.</span></span></div><div><span styl=
e=3D"font-size:small;background-color:rgb(255,255,255);float:none;display:i=
nline"><span><br></span></span></div><div><span style=3D"font-size:small;ba=
ckground-color:rgb(255,255,255);float:none;display:inline"><span>We can alr=
eady do:</span></span></div><div><span style=3D"font-size:small;background-=
color:rgb(255,255,255);float:none;display:inline"><span><br></span></span><=
/div><div><div style=3D"font-size:small;background-color:rgb(255,255,255)">=
<span style=3D"font-size:small;background-color:rgb(255,255,255);float:none=
;display:inline"><span><font face=3D"monospace, monospace">void func(height=
 val);</font></span></span></div><div style=3D"font-size:small;background-c=
olor:rgb(255,255,255)"><span style=3D"font-size:small;background-color:rgb(=
255,255,255);float:none;display:inline"><span><font face=3D"monospace, mono=
space">void func(width val);</font></span></span></div><div><br></div>Where=
</div><div><br></div><div><font face=3D"monospace, monospace">using height =
=3D tagged_value&lt;struct height_tag, int&gt;;</font></div><div><font face=
=3D"monospace, monospace">template&lt;typename Tag&gt; struct <span style=
=3D"font-size:small;background-color:rgb(255,255,255);float:none;display:in=
line">tagged_value { .. implement in terms of services expressed by the tag=
.... };</span></font></div><div><br></div><div>=C2=A0Which is IMHO more expr=
essive.</div><div><br></div><div>An existing (very complete) model of this:=
=C2=A0<a onmousedown=3D"this.href=3D&#39;https://www.google.com/url?q\x3dht=
tps%3A%2F%2Fwww.boost.org%2Fdoc%2Flibs%2F1_67_0%2Fdoc%2Fhtml%2Fboost_units.=
html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHfsIv8WL2pPVFxDMmIoV22x7Nsog&#=
39;;return true;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\=
x3dhttps%3A%2F%2Fwww.boost.org%2Fdoc%2Flibs%2F1_67_0%2Fdoc%2Fhtml%2Fboost_u=
nits.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHfsIv8WL2pPVFxDMmIoV22x7N=
sog&#39;;return true;" href=3D"https://www.boost.org/doc/libs/1_67_0/doc/ht=
ml/boost_units.html" target=3D"_blank" rel=3D"nofollow">https://www.boost.o=
rg/<wbr>doc/libs/1_67_0/doc/html/<wbr>boost_units.html</a></div></div></div=
></blockquote><div><br></div><div>This can&#39;t handle nearly enough cases=
 and is much more intrusive to the function - val is now a different type, =
this leaks into the implementation as well</div></div></blockquote><div><br=
></div></div></div></blockquote><div>=C2=A0</div><blockquote class=3D"gmail=
_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;p=
adding-left: 1ex;"><div dir=3D"ltr"><div class=3D"gmail_quote"><div></div><=
div>Different semantic meaning =3D=3D different type is a *good thing* as i=
t allows relationships and operations to be checked at compile time. That m=
eans fewer bugs.=C2=A0</div><div>=C2=A0</div><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr"><div><br></div><div>Also consider=C2=A0<br></div><div><fo=
nt face=3D"courier new,monospace"><span style=3D"display:inline!important;f=
loat:none;background-color:transparent;color:rgb(34,34,34);font-family:cour=
ier new,monospace;font-size:13px;font-style:normal;font-variant:normal;font=
-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text=
-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Rect(c=
enter: Point c, Size size);</span></font></div><div><font face=3D"courier n=
ew,monospace"><span style=3D"display:inline!important;float:none;background=
-color:transparent;color:rgb(34,34,34);font-family:courier new,monospace;fo=
nt-size:13px;font-style:normal;font-variant:normal;font-weight:400;letter-s=
pacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-tra=
nsform:none;white-space:normal;word-spacing:0px">Rect(topLeft: Point tl, Si=
ze size);</span><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike=
><br></font></div><div><font face=3D"courier new,monospace"><span style=3D"=
background-color:transparent;border-bottom-color:rgb(34,34,34);border-botto=
m-style:none;border-bottom-width:0px;border-left-color:rgb(34,34,34);border=
-left-style:none;border-left-width:0px;border-right-color:rgb(34,34,34);bor=
der-right-style:none;border-right-width:0px;border-top-color:rgb(34,34,34);=
border-top-style:none;border-top-width:0px;color:rgb(34,34,34);display:inli=
ne;float:none;font-family:courier new,monospace;font-size:13px;font-style:n=
ormal;font-variant:normal;font-weight:400;letter-spacing:normal;margin-bott=
om:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:0px;p=
adding-left:0px;padding-right:0px;padding-top:0px;text-align:left;text-deco=
ration:none;text-indent:0px;text-transform:none;white-space:normal;word-spa=
cing:0px">Rect(bottomLeft: Point bl, Size size);</span></font></div><div><f=
ont face=3D"courier new,monospace"><span style=3D"background-color:transpar=
ent;border-bottom-color:rgb(34,34,34);border-bottom-style:none;border-botto=
m-width:0px;border-left-color:rgb(34,34,34);border-left-style:none;border-l=
eft-width:0px;border-right-color:rgb(34,34,34);border-right-style:none;bord=
er-right-width:0px;border-top-color:rgb(34,34,34);border-top-style:none;bor=
der-top-width:0px;color:rgb(34,34,34);display:inline;float:none;font-family=
:courier new,monospace;font-size:13px;font-style:normal;font-variant:normal=
;font-weight:400;letter-spacing:normal;margin-bottom:0px;margin-left:0px;ma=
rgin-right:0px;margin-top:0px;padding-bottom:0px;padding-left:0px;padding-r=
ight:0px;padding-top:0px;text-align:left;text-decoration:none;text-indent:0=
px;text-transform:none;white-space:normal;word-spacing:0px"><br></span></fo=
nt></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(34,34,34=
);text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;l=
etter-spacing:normal;font-size:13px;font-style:normal;font-variant:normal;f=
ont-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-s=
pace:normal;float:none;background-color:transparent"><font face=3D"arial,sa=
ns-serif">Semantically some BottomLeftPointType is just wrong</font></span>=
</div></div></blockquote><div><br></div><div>It&#39;s only wrong if the beh=
aviour of a bottom-left point is different to the behaviour of a top-left p=
oint. If it&#39;s not, then why bother tagging?</div></div></div></blockquo=
te><div><br></div><div>The user must say what point he is supplying so the =
ctor can fill the rest by using size.=C2=A0</div><div><br></div><div><font =
face=3D"courier new,monospace">Rect({0, 0}, {10, 12}) // top:0 left:0 botto=
m: 12 right:10</font></div><div><div style=3D"background-color: transparent=
; border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-b=
ottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; bor=
der-image-slice: 100%; border-image-source: none; border-image-width: 1; bo=
rder-left-color: rgb(34, 34, 34); border-left-style: none; border-left-widt=
h: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; bord=
er-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: n=
one; border-top-width: 0px; color: rgb(34, 34, 34); font-family: &amp;quot;=
Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif; font-size: 13px; =
font-style: normal; font-variant: normal; font-weight: 400; letter-spacing:=
 normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-to=
p: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: =
0px; padding-top: 0px; text-align: left; text-decoration: none; text-indent=
: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: n=
ormal; word-spacing: 0px;"><font face=3D"courier new,monospace"></font><br =
style=3D"background-attachment: scroll; background-clip: border-box; backgr=
ound-color: transparent; background-image: none; background-origin: padding=
-box; background-position-x: 0%; background-position-y: 0%; background-repe=
at: repeat; background-size: auto; border-bottom-color: rgb(34, 34, 34); bo=
rder-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; =
border-image-repeat: stretch; border-image-slice: 100%; border-image-source=
: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-l=
eft-style: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34=
); border-right-style: none; border-right-width: 0px; border-top-color: rgb=
(34, 34, 34); border-top-style: none; border-top-width: 0px; color: rgb(34,=
 34, 34); font-family: &amp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;qu=
ot;,sans-serif; font-size: 13px; height: auto; margin-bottom: 0px; margin-l=
eft: 0px; margin-right: 0px; margin-top: 0px; min-width: 0px; overflow: vis=
ible; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; paddin=
g-left: 0px; padding-right: 0px; padding-top: 0px;"></div><div style=3D"bac=
kground-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bo=
ttom-style: none; border-bottom-width: 0px; border-image-outset: 0; border-=
image-repeat: stretch; border-image-slice: 100%; border-image-source: none;=
 border-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-sty=
le: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); bord=
er-right-style: none; border-right-width: 0px; border-top-color: rgb(34, 34=
, 34); border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34=
); font-family: &amp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,san=
s-serif; font-size: 13px; font-style: normal; font-variant: normal; font-we=
ight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; ma=
rgin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-=
left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-dec=
oration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-=
width: 0px; white-space: normal; word-spacing: 0px;"><font face=3D"courier =
new,monospace">Rect(center: {0, 0}, {10, 12}) // top:-5 left:-6 bottom: 5 r=
ight: 6</font></div><b></b><i></i><u></u><sub></sub><sup></sup><strike></st=
rike><font face=3D"courier new,monospace"></font><br></div><div>=C2=A0<span=
 style=3D"display: inline !important; float: none; background-color: transp=
arent; color: rgb(34, 34, 34); font-family: &quot;Arial&quot;,&quot;Helveti=
ca&quot;,sans-serif; font-size: 13px; font-style: normal; font-variant: nor=
mal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left=
; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-te=
xt-stroke-width: 0px; white-space: normal; word-spacing: 0px;">The points a=
re the same, making them different type is wrong semantically as you probab=
ly agree.</span></div><div><span style=3D"display: inline !important; float=
: none; background-color: transparent; color: rgb(34, 34, 34); font-family:=
 &quot;Arial&quot;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; font-=
style: normal; font-variant: normal; font-weight: 400; letter-spacing: norm=
al; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; =
text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; =
word-spacing: 0px;"><br></span></div><blockquote class=3D"gmail_quote" styl=
e=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left:=
 1ex;"><div dir=3D"ltr"><div class=3D"gmail_quote"><div>=C2=A0</div><blockq=
uote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc =
solid;padding-left:1ex"><div dir=3D"ltr"><div><span style=3D"margin:0px;pad=
ding:0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);text-=
transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-st=
yle:normal;font-variant:normal;font-weight:400;text-decoration:none;word-sp=
acing:0px;display:inline;white-space:normal;float:none;background-color:tra=
nsparent"><font face=3D"arial,sans-serif"><br></font></span></div><div><spa=
n style=3D"margin:0px;padding:0px;border:0px rgb(34,34,34);text-align:left;=
color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:norm=
al;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;tex=
t-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:=
none;background-color:transparent"><font face=3D"arial,sans-serif"><br></fo=
nt></span></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(3=
4,34,34);text-align:left;color:rgb(34,34,34);text-transform:none;text-inden=
t:0px;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:n=
ormal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;=
white-space:normal;float:none;background-color:transparent"><font face=3D"a=
rial,sans-serif">In general very often we want <i>both</i> the old types an=
d the old function name, but to have a different implementation (to do some=
thing different).=C2=A0</font></span></div><div><span style=3D"margin:0px;p=
adding:0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);tex=
t-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-=
style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-=
spacing:0px;display:inline;white-space:normal;float:none;background-color:t=
ransparent"><font face=3D"arial,sans-serif"><br></font></span></div><div><s=
pan style=3D"margin:0px;padding:0px;border:0px rgb(34,34,34);text-align:lef=
t;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:no=
rmal;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;t=
ext-decoration:none;word-spacing:0px;display:inline;white-space:normal;floa=
t:none;background-color:transparent"><font face=3D"arial,sans-serif">This i=
s why tags are so great and this suggestion is just an extension of that, t=
he same way structured binding are syntax sugar for the returned struct.</f=
ont></span></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(=
34,34,34);text-align:left;color:rgb(34,34,34);text-transform:none;text-inde=
nt:0px;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:=
normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline=
;white-space:normal;float:none;background-color:transparent"><font face=3D"=
arial,sans-serif"><br></font></span></div><div><span style=3D"margin:0px;pa=
dding:0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);text=
-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-s=
tyle:normal;font-variant:normal;font-weight:400;text-decoration:none;word-s=
pacing:0px;display:inline;white-space:normal;float:none;background-color:tr=
ansparent"><font face=3D"arial,sans-serif"><br></font></span></div><div><sp=
an style=3D"margin:0px;padding:0px;border:0px rgb(34,34,34);text-align:left=
;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:nor=
mal;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;te=
xt-decoration:none;word-spacing:0px;display:inline;white-space:normal;float=
:none;background-color:transparent"><font face=3D"arial,sans-serif">More re=
al word examples (slightly modified)</font></span></div><font face=3D"couri=
er new,monospace"><br>QImage(serializedData: const uchar *data, int size, c=
onst char *format =3D {}); <br></font></div></blockquote><div><br></div><di=
v><font face=3D"monospace, monospace">QImage(ByteBuffer const&amp;, FormatS=
tring const&amp;);=C2=A0 =C2=A0 // semantically meaningful, 1 fewer argumen=
ts, fewer errors</font></div></div></div></blockquote><div><br></div><div><=
br></div><div>This still does not work - ByteBuffer can be raw pixel data o=
r can be compressed (Jpeg) and the format can be omitted. We must introduce=
 SerializedByteBuffer.=C2=A0</div><div><br></div><div>Note that I agree wit=
h you in principal, but new type can be redundant (if used just in one plac=
e) or it might not scale - there might be dozens overloads</div><div>=C2=A0=
</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div cl=
ass=3D"gmail_quote"><div><br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><font face=3D"courier new,monospace"><br>QByteArray(base64: const =
QByteArray&amp; val);<br>QByteArray(percentEncoded: const QByteArray&amp; v=
al, char percent =3D &#39;%&#39;)<br><br>QByteArray(parseNumber: int val);=
=C2=A0<br>QByteArray(<span style=3D"display:inline!important;float:none;bac=
kground-color:transparent;color:rgb(34,34,34);font-family:courier new,monos=
pace;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;l=
etter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;t=
ext-transform:none;white-space:normal;word-spacing:0px">parseNumber</span>:=
 double val);</font><div></div><div><b></b><i></i><u></u><sub></sub><sup></=
sup><strike></strike><font face=3D"courier new,monospace"></font><br></div>=
<div>Note the last two in particular - special type will be=C2=A0 <i>comple=
tely</i> redundant - parseDoubleNumber{5} or something like that.</div></di=
v></blockquote><div><br></div><div><font face=3D"monospace, monospace">temp=
late&lt;class Numeric&gt; struct parse_number { ... };</font></div><div><di=
v style=3D"background-color:rgb(255,255,255)"><font face=3D"monospace, mono=
space">QByteArray(parse_number(5));=C2=A0 =C2=A0 //c++17 template type dedu=
ction yields parse_number&lt;int&gt;</font></div><div style=3D"background-c=
olor:rgb(255,255,255)"><font face=3D"monospace, monospace">QByteArray(parse=
_number(5.0));<wbr>=C2=A0=C2=A0<span style=3D"float:none;display:inline">//=
c++17 template type deduction yields parse_number&lt;double&gt;</span></fon=
t></div></div></div></div></blockquote><div><br></div><div>This is confusin=
g as it looks like we create a byte array by a function (or functor) and pa=
ss it to the a ctor.</div><div>It also leaks detail into the implementation=
 - we must code in terms of some odd <span style=3D"display: inline !import=
ant; float: none; background-color: transparent; color: rgb(34, 34, 34); fo=
nt-family: monospace, monospace; font-size: 13px; font-style: normal; font-=
variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text=
-align: left; text-decoration: none; text-indent: 0px; text-transform: none=
; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">=
parse_number <font face=3D"arial,sans-serif">argument.=C2=A0</font></span><=
/div><div><span style=3D"display: inline !important; float: none; backgroun=
d-color: transparent; color: rgb(34, 34, 34); font-family: monospace, monos=
pace; font-size: 13px; font-style: normal; font-variant: normal; font-weigh=
t: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decorati=
on: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width=
: 0px; white-space: normal; word-spacing: 0px;"><font face=3D"arial,sans-se=
rif"><br></font></span></div><div><span style=3D"display: inline !important=
; float: none; background-color: transparent; color: rgb(34, 34, 34); font-=
family: monospace, monospace; font-size: 13px; font-style: normal; font-var=
iant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-al=
ign: left; text-decoration: none; text-indent: 0px; text-transform: none; -=
webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><fo=
nt face=3D"arial,sans-serif">This is just a workaround, not something seman=
tically better (as arguably the Buffer example)</font></span></div><div><br=
></div><div><br></div><div>In general named params are The Right Solution i=
f the types must semantically stay the same (incl. in the implementation) -=
 Points, numbers, but often strings, images.</div><div><br></div><ul><li><f=
ont face=3D"arial,sans-serif">First, middle, last name should not be a diff=
erent type (well depends on the language, but you get the idea).=C2=A0</fon=
t></li><li><font face=3D"arial,sans-serif">Window title icon and window tra=
y icon should not be a different type.</font></li><li><font face=3D"arial,s=
ans-serif">Header text should not be different type then Footer text</font>=
</li><li><font face=3D"arial,sans-serif">Tooltip and status text are the sa=
me type of string</font></li><li><font face=3D"arial,sans-serif">16x16, 24x=
24, 32x32 etc in a icon class are the same type - an image<br></font></li><=
/ul><font face=3D"arial,sans-serif"><div>Honestly, the list is long, we jus=
t don&#39;t notice it as we learned to get around of it in one form or anot=
her,</div><div>modeling our interfaces around the issues or simply dropping=
 useful interfaces as they are hard or cumbersome to express .</div></font>=
<div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><div class=3D"gmail_quote"><div><br><br></div><div>=C2=A0There was a gr=
eat CppCon talk on this. It&#39;s worth seeking out.</div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr"><div><br></div><div><br></div><div><font fac=
e=3D"courier new,monospace"><b></b><i></i><u></u><sub></sub><sup></sup><str=
ike></strike><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><b=
></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></font></div>=
</div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a onmousedown=3D"this.href=3D&#39;javascript:&#39;;return true;" o=
nclick=3D"this.href=3D&#39;javascript:&#39;;return true;" href=3D"javascrip=
t:" target=3D"_blank" rel=3D"nofollow" gdf-obfuscated-mailto=3D"JBQ1R_HHBQA=
J">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a onmousedown=3D"this.href=3D&#39;jav=
ascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;re=
turn true;" href=3D"javascript:" target=3D"_blank" rel=3D"nofollow" gdf-obf=
uscated-mailto=3D"JBQ1R_HHBQAJ">std-pr...@isocpp.org</a>.<br>
To view this discussion on the web visit <a onmousedown=3D"this.href=3D&#39=
;https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043=
-4ad4-bab4-513ddd633abe%40isocpp.org?utm_medium\x3demail\x26utm_source\x3df=
ooter&#39;;return true;" onclick=3D"this.href=3D&#39;https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-4ad4-bab4-513ddd633abe=
%40isocpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;=
" href=3D"https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/da3e=
4418-e043-4ad4-bab4-513ddd633abe%40isocpp.org?utm_medium=3Demail&amp;utm_so=
urce=3Dfooter" target=3D"_blank" rel=3D"nofollow">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/da3e4418-e043-4ad4-<wbr>bab4-=
513ddd633abe%40isocpp.org</a><wbr>.<br>
</blockquote></div></div>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/41949fb9-c3b6-4d16-a760-2d9064bce683%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/41949fb9-c3b6-4d16-a760-2d9064bce683=
%40isocpp.org</a>.<br />

------=_Part_110959_1408536446.1531162588127--

------=_Part_110958_324298937.1531162588126--

.
