From owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org  Thu Sep 28 19:37:16 2017
Return-Path: <owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org>
X-Original-To: sc22wg5-dom8
Delivered-To: sc22wg5-dom8@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id A9BF1358A24; Thu, 28 Sep 2017 19:37:15 +0200 (CEST)
Delivered-To: sc22wg5@open-std.org
Received: from mail-pg0-f48.google.com (mail-pg0-f48.google.com [74.125.83.48])
	(using TLSv1 with cipher AES128-SHA (128/128 bits))
	(No client certificate requested)
	by www.open-std.org (Postfix) with ESMTP id DE149356CDE
	for <sc22wg5@open-std.org>; Thu, 28 Sep 2017 19:37:12 +0200 (CEST)
Received: by mail-pg0-f48.google.com with SMTP id j70so1313160pgc.10
        for <sc22wg5@open-std.org>; Thu, 28 Sep 2017 10:37:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=sourceryinstitute.org; s=google;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version;
        bh=ic7isVSCWd28tI4wBIb0xJkdjbLdWnkiqug5XHk0VpE=;
        b=RN24dPbukAuE83x16C+ugRiAkDymQDZT+BaPAUKcmQyKj+LYW+tjG9Wfr4HATS0vVr
         HZ/ftyCXmMRZnFNCFMNCYxRLcpuqPHopMqq5wYpao5+DoP6XyNJnHN2WjWphjXMHfrK9
         7o6mr42y/DbOKk7H1vDTOUGE3owtLqyWvE/QQs380nO/0F/cnhBMdgT4jAtIEALRQ7FM
         77Ap2J8kHn8ormr0lb339qfTmNlavciDfYl8qKd6kTJqNnSh4o3yoX/sPOpr5KDGopGp
         OT5pcxBdCB93Fiqbz0wuVS69g6rV5xfg9nrwJq4EQLhKlav7NVuvskyXu+tquhLj5q1O
         +5eQ==
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:cc:message-id:in-reply-to
         :references:subject:mime-version;
        bh=ic7isVSCWd28tI4wBIb0xJkdjbLdWnkiqug5XHk0VpE=;
        b=FRifi95k9NWloXymCU3fpCLJaMU157H7oCtuvGvhHVyZS28VfbK+lDAz5iyO8bSt1r
         D7/aV/dXnRUrndoA/IN4h3M/yA9mtyb3qkkO2TxytLdMb5SeGcM12N7vdVwrJwvZ0UCO
         FOyQ5s7dgcFhp/q+9ao/CfzeIcG+cKLjG9IQq+iGO6UYsiDDQ1+1zoTM00F6osTRFjHK
         DB4BTtIjL7BHfnO7nTSL7Xyo9HmLGvbeKTGaHioPNBE+llt0slsZa4SNha8B5bGxbPN4
         pWszH4rug9xWwNaj0bkJGK0W7kBq40dQwmTN76WkJ7E9c0/YzUVV5py+hA9TE5dZExM0
         pZbQ==
X-Gm-Message-State: AHPjjUh3fnUCYt/0TJ5WVdWSTDMWPdlwFXy0PGn86SHzeWBFRO2YJWvC
	CwLOKPbdT1Z1PjP1Sxs9IvwInA==
X-Google-Smtp-Source: AOwi7QCDsM13g/f+VFmsYqvB9ustVwBi04AvK9nIRz34zXaIjESR39kT/W17zCLiokTtbEMLc9wTbQ==
X-Received: by 10.84.133.41 with SMTP id 38mr4544166plf.203.1506620231215;
        Thu, 28 Sep 2017 10:37:11 -0700 (PDT)
Received: from localhost.mail ([50.233.164.226])
        by smtp.gmail.com with ESMTPSA id i3sm3769644pgs.23.2017.09.28.10.37.09
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 28 Sep 2017 10:37:10 -0700 (PDT)
Date: Thu, 28 Sep 2017 10:37:07 -0700
From: Damian Rouson <damian@sourceryinstitute.org>
To: Bill Long <longb@cray.com>, fortran standards email list for J3
 <j3@mailman.j3-fortran.org>
Cc: sc22wg5 <sc22wg5@open-std.org>, Van Snyder
 <van.snyder@jpl.nasa.gov>
Message-ID: <etPan.59cd3343.3eb1add9.1302@sourceryinstitute.org>
In-Reply-To: <20170928161910.0439E358A27@www.open-std.org>
References: <20170927201113.6D137358742@www.open-std.org>
 <CEB03336-C898-4C72-9BB9-C533DBDFC4C8@cray.com>
 <20170928020816.B2E4D358742@www.open-std.org>
 <20170928123430.2C442358929@www.open-std.org>
 <20170928161910.0439E358A27@www.open-std.org>
Subject: Re: (j3.2006) (SC22WG5.5979) Generic programming examples
X-Mailer: Airmail (442)
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="59cd3343_662a642c_1302"
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

--59cd3343_662a642c_1302
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline



On September 28, 2017 at 9:19:14 AM, Bill Long (longb=40cray.com) wrote:


> On Sep 28, 2017, at 7:34 AM, Clune, Thomas L. (GS=46C-6101) <thomas.l.c=
lune=40nasa.gov> wrote:=C2=A0
>=C2=A0
> Sorry - not sure how my subconscious injected the word =E2=80=9Cexcepti=
ons=E2=80=9D below. I meant =E2=80=9CUsing generics/templates should not =
make us lose this other =5Btype-bound procedures=5D capability.=E2=80=9D=C2=
=A0
>=C2=A0

Makes more sense now.=C2=A0

A type bound procedure referenced though a polymorphic variable cannot it=
self be a template because the compiler does not know what procedure is b=
eing called at compile time. However, inside the specific TBP, you can ca=
ll worker routines that do the actual work, and those can be written as t=
emplates if that would be useful. There is a (probably small) performance=
 hit for the second call, but you are already making an anti-performance =
decision by using the TBP path in the first place. Whether this matters t=
hat much depends on how you decide to organize the code.=C2=A0
I suspect that these are some of the reasons that many in the C++ communi=
ty are moving away from runtime polymorphism and inheritance and migratin=
g more toward compile-time polymorphism and templates. =C2=A0Partly for t=
his reason, I=E2=80=99ve been hoping to get one collaborator to join J3/W=
G5 who specializes in language design, has some experience on the C++ com=
mittee, has an interest in modern =46ortran, and was one of the first peo=
ple to mention the aforementioned trend in C++ programming practices. =C2=
=A0What Bill describes above might be a good compromise between the two p=
rogramming styles. I=E2=80=99m not surprised there=E2=80=99s some tension=
 between the two.

Damian
--59cd3343_662a642c_1302
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<html><head><style>body=7Bfont-family:Helvetica,Arial;font-size:13px=7D</=
style></head><body style=3D=22word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;=22><div id=3D=22bloop=5Fcust=
omfont=22 style=3D=22font-family:Helvetica,Arial;font-size:13px; color: r=
gba(0,0,0,1.0); margin: 0px; line-height: auto;=22><br></div> <br><p clas=
s=3D=22airmail=5Fon=22>On September 28, 2017 at 9:19:14 AM, Bill Long (<a=
 href=3D=22mailto:longb=40cray.com=22>longb=40cray.com</a>) wrote:</p> <d=
iv><blockquote type=3D=22cite=22 class=3D=22clean=5Fbq=22 style=3D=22font=
-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-vari=
ant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: a=
uto; text-align: start; text-indent: 0px; text-transform: none; white-spa=
ce: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: au=
to; -webkit-text-stroke-width: 0px;=22><span><div><div></div><div><br>&gt=
; On Sep 28, 2017, at 7:34 AM, Clune, Thomas L. (GS=46C-6101) &lt;thomas.=
l.clune=40nasa.gov&gt; wrote:<span class=3D=22Apple-converted-space=22>&n=
bsp;</span><br>&gt;<span class=3D=22Apple-converted-space=22>&nbsp;</span=
><br>&gt; Sorry - not sure how my subconscious injected the word =E2=80=9C=
exceptions=E2=80=9D below. I meant =E2=80=9CUsing generics/templates shou=
ld not make us lose this other =5Btype-bound procedures=5D capability.=E2=
=80=9D<span class=3D=22Apple-converted-space=22>&nbsp;</span><br>&gt;<spa=
n class=3D=22Apple-converted-space=22>&nbsp;</span><br><br>Makes more sen=
se now.<span class=3D=22Apple-converted-space=22>&nbsp;</span><br><br>A t=
ype bound procedure referenced though a polymorphic variable cannot itsel=
f be a template because the compiler does not know what procedure is bein=
g called at compile time. However, inside the specific TBP, you can call =
worker routines that do the actual work, and those can be written as temp=
lates if that would be useful. There is a (probably small) performance hi=
t for the second call, but you are already making an anti-performance dec=
ision by using the TBP path in the first place. Whether this matters that=
 much depends on how you decide to organize the code.<span class=3D=22App=
le-converted-space=22>&nbsp;</span></div></div></span></blockquote></div>=
<p>I suspect that these are some of the reasons that many in the C++ comm=
unity are moving away from runtime polymorphism and inheritance and migra=
ting more toward compile-time polymorphism and templates. &nbsp;Partly fo=
r this reason, I=E2=80=99ve been hoping to get one collaborator to join J=
3/WG5 who specializes in language design, has some experience on the C++ =
committee, has an interest in modern =46ortran, and was one of the first =
people to mention the aforementioned trend in C++ programming practices. =
&nbsp;What Bill describes above might be a good compromise between the tw=
o programming styles. I=E2=80=99m not surprised there=E2=80=99s some tens=
ion between the two.</p><p>Damian</p></body></html>
--59cd3343_662a642c_1302--

