220 40935 <b49f4c85-816b-4b35-851d-407061a8ef9f@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: mihailnajdenov@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Can we have beginner friendly new line and
 deprecate std::endl?
Date: Fri, 9 Nov 2018 01:19:04 -0800 (PST)
Lines: 184
Approved: news@gmane.org
Message-ID: <b49f4c85-816b-4b35-851d-407061a8ef9f@isocpp.org>
References: <e17189bf-51be-496d-845a-3707a516a210@isocpp.org> <CAMmfjbOkdN63EON+hrCJWj94n48vtVvMfUjzeau5KmPWSpwkow@mail.gmail.com> <CAHSYqdYYZjeHHbRZ5bcHLYVsWfspwCeQ8oxEDRbuJ8dqAtsX5A@mail.gmail.com>
 <AB167E1A-FA59-4B72-A9C2-1624D1B56614@hsr.ch>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_831_1553175585.1541755144847"
X-Trace: blaine.gmane.org 1541755021 25204 195.159.176.226 (9 Nov 2018 09:17:01 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 9 Nov 2018 09:17:01 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCUJ3A7GRAPRBCNCSXPQKGQE7T3IQYA@isocpp.org Fri Nov 09 10:16:57 2018
Return-path: <std-proposals+bncBCUJ3A7GRAPRBCNCSXPQKGQE7T3IQYA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb1-f200.google.com ([209.85.219.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUJ3A7GRAPRBCNCSXPQKGQE7T3IQYA@isocpp.org>)
	id 1gL2uO-0006QV-Qf
	for gclcip-std-proposals@m.gmane.org; Fri, 09 Nov 2018 10:16:57 +0100
Original-Received: by mail-yb1-f200.google.com with SMTP id x12-v6sf2053455ybp.9
        for <gclcip-std-proposals@m.gmane.org>; Fri, 09 Nov 2018 01:19:07 -0800 (PST)
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=14xHi5yFu6/QwpTtym/3uvgQ3Q1sHY24bqs+1eD5BJ8=;
        b=uH9dJYbHoKQHJ7VEla601ujGPHCUW2WJhFgZ4GMZ2SPw2Cw6W+f+LZDGrt7guq5f9i
         OZFNjnaStU8UFqOHmCrqfBj4um26zUVPtwuzcbiD7AWfAxriH6Ezmt06zD2LTajLXA3b
         ZqAhBg07Bp8wzDSaIwalTrKeWnjZMHyxVQfQ0RDZuvI+im835Fy/raPGMGDBSONvZmDT
         8Xmi8SOERpBXoi00tP5aFOYcx/1EV0vfdHt1lwujEapaMw+YvcOLe3DrL65K/xmUkUhK
         vgmpxR+RJw8BQydVUeW7rgrbWlvlH51c0x86wyizWWP6ofFDw1kVvUGTYqwlOi/Rl8ko
         ODVA==
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=14xHi5yFu6/QwpTtym/3uvgQ3Q1sHY24bqs+1eD5BJ8=;
        b=W0/toiUt61SYsdfe0GA0VxmI81cdFKqNJHilPAfnE4s1gQ6v05b3Mz0bWcrV6C2PIQ
         TFEJJbZHxnnXNLzrUWQ8zXxTPyiY1FJmskSmYK80vTgBlV6Wy4BAx6aQiVXEplfWoGSY
         HIUDDCKuVOEMZoOsrAvVqx0WLVXWA20FAuAnd53L3mAMtrmlg6eStTtwSAU7M3QSmH5N
         vDZor3qBPpb5OCbz0NLWjvZ3a69NrgdS7fSt+Z3FYZfxYJZds2LrX90RdN8OHXK27Tob
         +1wpi0k7llLQQv2Wd1Pi22uhKSNwEOkpJfy5C7+PgGxtFTtaKDAoTzij7sOoAE76Z0+A
         zt3g==
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=14xHi5yFu6/QwpTtym/3uvgQ3Q1sHY24bqs+1eD5BJ8=;
        b=pRClSlBEpAGvwpPABno1DNum+8Jyp06bCV1vdxO2JGHNfg5eMmVTYUR1xE9jwMptzv
         CbZn/ntESHarQZEhIe0azhGZHRkd0mFtRWu3TNpybwECh2wJS6P7zAzzIQzKDxXj/uPp
         E7+FX3Xqn1Wx7MPuZP+tIPUt2rhYNn2RKXtF0dQeol8aMbzRrsF9IY073AFYr9wtiZlv
         xx77bpdDqlZOmUgUrNGePosT7prfF8mI2JBUzvk6RxJy31s0IQEI2y2EL32YnU1/Llk1
         dUylqjb6TN8no2mjKY8rZ4QjuVW8kzTarpZjM1M9ccGl5e7ohxcGvx2k8svAarr7nbf8
         Fp+Q==
X-Gm-Message-State: AGRZ1gI/ufra5Vj6luQMNPHeuwLmzsfYiGx87gcLgiu6uwKR7BkJrbQC
	8IxMQTcEtC4m+yPGTZ4a/sDBdQ==
X-Google-Smtp-Source: AJdET5fXewAaYzmm6iooy3pW+eYH2gy6WUnp/0T5aWOG9Wg/l7aIU4Bh6aeoo2srlUL/DkKFvD9F1g==
X-Received: by 2002:a81:68d5:: with SMTP id d204-v6mr3981889ywc.8.1541755146824;
        Fri, 09 Nov 2018 01:19:06 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a81:150:: with SMTP id 77-v6ls589970ywb.6.gmail; Fri, 09 Nov
 2018 01:19:05 -0800 (PST)
X-Received: by 2002:a0d:d703:: with SMTP id z3-v6mr100756ywd.7.1541755145514;
        Fri, 09 Nov 2018 01:19:05 -0800 (PST)
In-Reply-To: <AB167E1A-FA59-4B72-A9C2-1624D1B56614@hsr.ch>
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:40935
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40935>

------=_Part_831_1553175585.1541755144847
Content-Type: multipart/alternative; 
	boundary="----=_Part_832_1870195055.1541755144848"

------=_Part_832_1870195055.1541755144848
Content-Type: text/plain; charset="UTF-8"

There are multiple problems with '\n'

First - it is ultimately C ("way")
Second, when we introduce simple output to beginners, for which cout is 
actually good because of overloading,
when using '\n' we have to introduce additional topics 
 - the fact a char can be more the one, well, character
 - special magic characters
We also create asymmetry b/w what is used to start the output std::cout (an 
object), to modify it (hex) and what is used to end it ("magic").

This screams some design flaw - we should be able to insert a new lines the 
same way we modify the stream!

On its own std::endl has the flaw that it does not obey the "do one thing" 
rule.
Once we deprecate it, this will shut down all the naive tutorials/courses 
still teaching it as the default! 


As for std::newline, we have options - 

std::nl //< even a beginner can "read" it
std::newl //< orthogonal to endl
std::br //< why not at this point!
std::brl
std::bl

Geeks can still use `\n`, but a beginner (and a teacher) will have a 
simple, *correct, *go-to option that models the syntax already introduced 
(std::cout)!


On Friday, November 9, 2018 at 8:22:26 AM UTC+2, PeterSommerlad wrote:
>
> So the better way is do better teaching. I show my students that they 
> should not use endl, except when they need it.
>
> Sent from Peter Sommerlad's iPad
> +41 79 432 23 32
>
> On 8 Nov 2018, at 23:43, Hyman Rosen <hyman...@gmail.com <javascript:>> 
> wrote:
>
> On Thu, Nov 8, 2018 at 5:08 PM Brian Bi <bbi...@gmail.com <javascript:>> 
> wrote:
>
>> I think the reason why novices use std::endl is that they're under the 
>> impression (no doubt perpetuated by incompetent educators) that std::endl 
>> is portable whereas '\n' isn't.
>>
>
> I think novices use std::endl because that's how C++ formatted I/O
> was presented for ages.  I have the feeling, completely unsupported
> by evidence, that the iostreams designers thought manipulators were
> really keen, and wanted to have one that would always get used.
>
> -- 
> 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/CAHSYqdYYZjeHHbRZ5bcHLYVsWfspwCeQ8oxEDRbuJ8dqAtsX5A%40mail.gmail.com 
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdYYZjeHHbRZ5bcHLYVsWfspwCeQ8oxEDRbuJ8dqAtsX5A%40mail.gmail.com?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/b49f4c85-816b-4b35-851d-407061a8ef9f%40isocpp.org.

------=_Part_832_1870195055.1541755144848
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">There are multiple problems with &#39;\n&#39;<div><br></di=
v><div>First - it is ultimately C (&quot;way&quot;)</div><div>Second, when =
we introduce simple output to beginners, for which cout is actually good be=
cause of overloading,</div><div>when using &#39;\n&#39; we have to introduc=
e additional topics=C2=A0<br><div>=C2=A0- the fact a char can be more the o=
ne, well, character</div><div>=C2=A0- special magic characters</div><div>We=
 also create asymmetry b/w what is used to start the output std::cout (an o=
bject), to modify it (hex) and what is used to end it (&quot;magic&quot;).<=
/div><div><br></div><div>This screams some design flaw - we should be able =
to insert a new lines the same way we modify the stream!</div><div><br></di=
v><div>On its own std::endl has the flaw that it does not obey the &quot;do=
 one thing&quot; rule.</div><div>Once we deprecate it, this will shut down =
all the naive tutorials/courses still teaching it as the default!=C2=A0</di=
v><div><br></div><div><br></div><div>As for std::newline, we have options -=
=C2=A0</div><div><br></div><div><font face=3D"courier new, monospace">std::=
nl //&lt; even a beginner can &quot;read&quot; it</font></div><div><font fa=
ce=3D"courier new, monospace">std::newl //&lt; orthogonal to endl</font></d=
iv><div><font face=3D"courier new, monospace">std::br //&lt; why not at thi=
s point!</font></div><div><font face=3D"courier new, monospace">std::brl</f=
ont></div><div><font face=3D"courier new, monospace">std::bl</font></div><d=
iv><br></div><div>Geeks can still use `\n`, but a beginner (and a teacher) =
will have a simple, <i>correct,=C2=A0</i>go-to option that models the synta=
x already introduced (std::cout)!</div><div><br><br>On Friday, November 9, =
2018 at 8:22:26 AM UTC+2, PeterSommerlad wrote:<blockquote class=3D"gmail_q=
uote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pad=
ding-left: 1ex;"><div dir=3D"auto">So the better way is do better teaching.=
 I show my students that they should not use endl, except when they need it=
..<br><br><div dir=3D"ltr">Sent from Peter Sommerlad&#39;s<span>=C2=A0iPad</=
span><div><span>+41 79 432 23 32</span></div></div><div dir=3D"ltr"><br>On =
8 Nov 2018, at 23:43, Hyman Rosen &lt;<a href=3D"javascript:" target=3D"_bl=
ank" gdf-obfuscated-mailto=3D"ZHex8pKwBAAJ" rel=3D"nofollow" onmousedown=3D=
"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#3=
9;javascript:&#39;;return true;">hyman...@gmail.com</a>&gt; wrote:<br><br><=
/div><blockquote type=3D"cite"><div dir=3D"ltr"><div dir=3D"ltr"><div class=
=3D"gmail_quote"><div dir=3D"ltr">On Thu, Nov 8, 2018 at 5:08 PM Brian Bi &=
lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"ZHex8=
pKwBAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;=
return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;">bb=
i...@gmail.com</a>&gt; wrote:</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"><div class=3D"gmail_quote"><div>I think the reason why novices use=
 std::endl is that they&#39;re under the impression (no doubt perpetuated b=
y incompetent educators) that std::endl is portable whereas &#39;\n&#39; is=
n&#39;t.</div></div></div></blockquote><div><br>I think novices use std::en=
dl because that&#39;s how C++ formatted I/O<br>was presented for ages.=C2=
=A0 I have the feeling, completely unsupported<br>by evidence, that the ios=
treams designers thought manipulators were<br>really keen, and wanted to ha=
ve one that would always get used.</div></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 href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
ZHex8pKwBAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"ZHex8pKwBAAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@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/CAHSYqdYYZjeHHbRZ5bcHLYVsWfspwCeQ8oxE=
DRbuJ8dqAtsX5A%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfooter"=
 target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https:/=
/groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdYYZjeHHbRZ5bcH=
LYVsWfspwCeQ8oxEDRbuJ8dqAtsX5A%40mail.gmail.com?utm_medium\x3demail\x26utm_=
source\x3dfooter&#39;;return true;" onclick=3D"this.href=3D&#39;https://gro=
ups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdYYZjeHHbRZ5bcHLYVs=
WfspwCeQ8oxEDRbuJ8dqAtsX5A%40mail.gmail.com?utm_medium\x3demail\x26utm_sour=
ce\x3dfooter&#39;;return true;">https://groups.google.com/a/<wbr>isocpp.org=
/d/msgid/std-<wbr>proposals/<wbr>CAHSYqdYYZjeHHbRZ5bcHLYVsWfspw<wbr>CeQ8oxE=
DRbuJ8dqAtsX5A%40mail.<wbr>gmail.com</a>.<br>
</div></blockquote></div></blockquote></div></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 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/b49f4c85-816b-4b35-851d-407061a8ef9f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b49f4c85-816b-4b35-851d-407061a8ef9f=
%40isocpp.org</a>.<br />

------=_Part_832_1870195055.1541755144848--

------=_Part_831_1553175585.1541755144847--

.
