220 17363 <CABsSThqr5VzxRzK4e94jtJz1PRB68GaceuwPX55Ak90hNEeMKA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Faisal Vali <faisalv@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: N4461 (Static if resurrected) -- on implementability
Date: Thu, 16 Apr 2015 06:32:16 -0500
Lines: 71
Approved: news@gmane.org
Message-ID: <CABsSThqr5VzxRzK4e94jtJz1PRB68GaceuwPX55Ak90hNEeMKA@mail.gmail.com>
References: <96b876e7-1ee0-41de-8ca9-842ef38206f3@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1429183950 22030 80.91.229.3 (16 Apr 2015 11:32:30 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 16 Apr 2015 11:32:30 +0000 (UTC)
To: "<std-proposals@isocpp.org>" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDDKRIXX5YARBQF3X2UQKGQEBSNU7JQ@isocpp.org Thu Apr 16 13:32:19 2015
Return-path: <std-proposals+bncBDDKRIXX5YARBQF3X2UQKGQEBSNU7JQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vn0-f69.google.com ([209.85.216.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDDKRIXX5YARBQF3X2UQKGQEBSNU7JQ@isocpp.org>)
	id 1Yii1r-00079S-1Z
	for gclcip-std-proposals@m.gmane.org; Thu, 16 Apr 2015 13:32:19 +0200
Original-Received: by vnbg62 with SMTP id g62sf108326356vnb.3
        for <gclcip-std-proposals@m.gmane.org>; Thu, 16 Apr 2015 04:32:18 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:reply-to:in-reply-to:references
         :date:message-id:subject:from:to:content-type
         :content-transfer-encoding:x-original-sender
         :x-original-authentication-results:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=z24/S8/4lBWR0Zs2GF0CqWNS6nRf3Kf5jypdW9iAZb4=;
        b=PpnAd0CZwxnFVe6pcdX+tRbdW5VYdiinqn7FDavAZ8Fjz1T6yTVQmkokngyN7a8bZ7
         xiRFuQb0MVAEXJ5NndDnOruVygO1w8TixgWkZNnuvsXl1kzh34qdszV+sONrdJkOOU/j
         lZrmBXKQlmQM6xcCRaGxLkhcRGFzdfVXTzcHaqmlcBvXI+a6fmYeNFX4u8t1sBB/OjtP
         Qr2/fruC0YWuSSsyhChSUnEbxP80SwG9DMOYfYa0b3gehho6LhkBViTxUkw/JKcxQPie
         Z0IwuvuPOUUrF9m98/VT2QjgV6vApzC12PlvZXfaw25awDg5GNLMdO/vwUZ7y/1uL+uh
         6Iyw==
X-Gm-Message-State: ALoCoQnbY0GIPqrXf5NW2aWY0gzpnLT7MQcgBdwVru5Tjw5MyQ1HrDNGzyipewjQB+cl3aJhrQDs
X-Received: by 10.52.189.7 with SMTP id ge7mr40873994vdc.6.1429183937978;
        Thu, 16 Apr 2015 04:32:17 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.39.140 with SMTP id n134ls876358ion.51.gmail; Thu, 16 Apr
 2015 04:32:16 -0700 (PDT)
X-Received: by 10.42.10.132 with SMTP id q4mr35963189icq.62.1429183936780;
        Thu, 16 Apr 2015 04:32:16 -0700 (PDT)
Original-Received: from mail-ig0-x22c.google.com (mail-ig0-x22c.google.com. [2607:f8b0:4001:c05::22c])
        by mx.google.com with ESMTPS id jd2si15826887igb.57.2015.04.16.04.32.16
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 16 Apr 2015 04:32:16 -0700 (PDT)
Received-SPF: pass (google.com: domain of faisalv@gmail.com designates 2607:f8b0:4001:c05::22c as permitted sender) client-ip=2607:f8b0:4001:c05::22c;
Original-Received: by igbyr2 with SMTP id yr2so74680182igb.0
        for <std-proposals@isocpp.org>; Thu, 16 Apr 2015 04:32:16 -0700 (PDT)
X-Received: by 10.107.12.158 with SMTP id 30mr40811639iom.61.1429183936322;
 Thu, 16 Apr 2015 04:32:16 -0700 (PDT)
Original-Received: by 10.50.176.170 with HTTP; Thu, 16 Apr 2015 04:32:16 -0700 (PDT)
In-Reply-To: <96b876e7-1ee0-41de-8ca9-842ef38206f3@isocpp.org>
X-Original-Sender: faisalv@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of faisalv@gmail.com designates 2607:f8b0:4001:c05::22c as permitted
 sender) smtp.mail=faisalv@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:17363
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/17363>

On Thu, Apr 16, 2015 at 4:58 AM, Andrzej Krzemie=C5=84ski <akrzemi1@gmail.c=
om> wrote:
> Hi All,
> I think that the "implementability" section of the paper on reduced stati=
c
> if proposal is too pessimistic.

I think I would agree with you - but I never know until i start
implementing these things (unlike certain clang Gallifreyans - *cough*
Richard *cough* - who see all implementation-potentialities at once).

I believe the implementation in clang could be fairly straightforward
- in very broad buggy strokes consider:
  - create a new AST Node that inherits from Stmt that stores the
condition stmt, and the two AST branches
  - if the AST node is not being parsed within a template (i.e. not in
a dependent context, and the condition's truth value can be determined
then), then consider lexing but not parsing the false branch??, else
within a dependent context, parse both arms as we would any
compound-stmt within a template definition
  - when instantiating a function template body, evaluate then the
static-if's condition, and then decide which branch to instantiate -
and then in the instantiated body replace the entire static-if node,
with the transformed compound statement...

Am I missing something obvious (or not so obvious)?

OK back to trying to get that pesky constexpr lambda proposal done in
time prior to lenexa - ( FYI - Geneva can be very distracting ... ;)

-faisal

> I tried to implement the two examples from
> "Motivation" section in C++14 with generic lambdas using the technique
> indicated by Paul Fultz II here:
> http://www.reddit.com/r/cpp/comments/295e77/clever_overloading_andrzejs_c=
_blog/
>
> You can see the result here:
> http://melpon.org/wandbox/permlink/ub4qmpDyIzkZWP1x
>
> While the syntax is obviously more ugly than what the paper describes, I
> believe the result is achievable in C++14 already. The compiler would onl=
y
> need to mechanically transform one notation into another.
>
> Regards,
> &rzej
>
> --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.

--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.
