Topic: Evaluate some function pre-conditions before


Author: Matthew Fioravante <fmatthew5876@gmail.com>
Date: Fri, 5 May 2017 10:12:35 -0700 (PDT)
Raw View
------=_Part_779_565108504.1494004355688
Content-Type: multipart/alternative;
 boundary="----=_Part_780_1739752636.1494004355689"

------=_Part_780_1739752636.1494004355689
Content-Type: text/plain; charset=UTF-8

One common use case that still requires macros is logging.

Suppose I have this API:

struct Logger {
  template <typename... A> void log(A&&...);
  template <typename... A> void logInfo(A&& ...a) { if(infoEnabled()) log(
std::forward<A>(a)...);}
  template <typename... A> void logDebug(A&& ...a) { if(debugEnabled()) log(
std::forward<A>(a)...);}

  bool infoEnabled() const;
  bool debugEnabled() const;
};

A lot of logging systems will look something like this. It has a big
problem however:


Logger log;
log.logDebug("Foo value is: ", someBigExpensiveCalculation());


In this example, even if debug logging is disabled,
someBigExpensiveCalculation() will still be called because the compiler
cannot know if the function has side effects. Some logging systems let you
turn off log levels at compile time. That makes this situation even worse
as we can't completely optimize out the call to this function.

The only way around this today that I know of is to use a macro.

#define LOG_DEBUG(logger, ...) if(logger.debugEnabled())
logger.logDebug(__VA_ARGS__)

Macros are bad for all the obvious reasons. Even worse, in many cases where
you're prepending headers or doing other stuff like that, you'll need to
use the non-standard ##__VA_ARGS__ to allow empty argument lists.

Logger log;
//someBigExpensiveCalculation() successfully optimized out if debug logging
turned off.
LOG_DEBUG(log, "Foo value is: ", someBigExpensiveCalculation());

Telling people to just write the if by hand is a non-starter. Its
cumbersome and error prone. I see this bug in the wild all the time.

if(some_error) {
  if(log.debugEnabled()) {
    log.logDebug("Error was: ", some_error, someErrorMessage());
    return some_error; //Oops, should be in outer scope!
  }
}


Or this bug:
if(some_error) {
  if(log.debugInfo()) { //Opps wrong level!
    log.logDebug("Error was: ", some_error, someErrorMessage());
  }
}

I don't know how to solve this problem. Essentially you would need some
kind of built-in pre-conditions on function calls.

Maybe something like this?

class Logger {
  template <typename... A> void logDebug(A&&... a) <-
(this->debugEnabled());
};

The <- syntax here defines a pre-condition. The rules might work like this:

* Evaluate only the subset of function arguments which appear within the
expression <-() (same unspecified order rules as normal for the subset)
* If <-() expression evaluates to true:
  * Evaluate remaining arguments (same unspecified order rules as normal)
  * Call the function

For functions with return values, you'd need to somehow specify what it
returns if the precondition check fails.

Or maybe another approach is to have some kind of unevaluated inline
perfect forwarding?


--
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/6adcf080-da93-4dca-b148-d5cbc9ce496e%40isocpp.org.

------=_Part_780_1739752636.1494004355689
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">One common use case that still requires macros is logging.=
<div><br></div><div>Suppose I have this API:</div><div><br></div><div><div =
class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border=
-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wr=
ap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint">=
<span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Logger</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">template</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">typename</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">...</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 A</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> log</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">A</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&amp;&amp;...);</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">template</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">typenam</span><font color=3D"#666600"><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">e</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">...</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> A</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">void<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> logInfo</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">A</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">a</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">if</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">infoEnabled</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">())</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> log</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">forward</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">A</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">a</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)...);}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></font><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">typenam</span><font color=3D"#666600"><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">e</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> A</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">void</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> logDebug</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">A=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">...</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">a</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">if</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">debugEnable=
d</span><span style=3D"color: #660;" class=3D"styled-by-prettify">())</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> log</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">std</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">forward</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">A</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&gt;(</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">a</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)..=
..);}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><b=
r>=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">b=
ool</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> infoEn=
abled</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">const</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">bool</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> debugEnabled</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">const</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br></span></font><font color=3D"#666600"><span style=3D"color: #660;=
" class=3D"styled-by-prettify">};</span></font></div></code></div><br>A lot=
 of logging systems will look something like this. It has a big problem how=
ever:</div><div><br></div><div><div class=3D"prettyprint" style=3D"backgrou=
nd-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-styl=
e: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyp=
rint"><div class=3D"subprettyprint"><br>Logger log;<br>log.logDebug(&quot;F=
oo value is: &quot;, someBigExpensiveCalculation());</div><div class=3D"sub=
prettyprint"><br></div></code></div><br>In this example, even if debug logg=
ing is disabled, someBigExpensiveCalculation() will still be called because=
 the compiler cannot know if the function has side effects. Some logging sy=
stems let you turn off log levels at compile time. That makes this situatio=
n even worse as we can&#39;t completely optimize out the call to this funct=
ion.</div><div><br></div><div>The only way around this today that I know of=
 is to use a macro.</div><div><br></div><div><div class=3D"prettyprint" sty=
le=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187=
); border-style: solid; border-width: 1px; word-wrap: break-word;"><code cl=
ass=3D"prettyprint"><div class=3D"subprettyprint"><font color=3D"#660066">#=
define LOG_DEBUG(logger, ...) if(logger.debugEnabled()) logger.logDebug(__V=
A_ARGS__)</font></div></code></div><br>Macros are bad for all the obvious r=
easons. Even worse, in many cases where you&#39;re prepending headers or do=
ing other stuff like that, you&#39;ll need to use the non-standard ##__VA_A=
RGS__ to allow empty argument lists.</div><div><br></div><div><div class=3D=
"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: =
rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: brea=
k-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><font co=
lor=3D"#660066">Logger log;<br>//someBigExpensiveCalculation() successfully=
 optimized out if debug logging turned off.<br>LOG_DEBUG(log, &quot;Foo val=
ue is: &quot;, someBigExpensiveCalculation());</font></div></code></div><di=
v><br></div><div>Telling people to just write the if by hand is a non-start=
er. Its cumbersome and error prone. I see this bug in the wild all the time=
..</div><div><br></div><div><div class=3D"prettyprint" style=3D"background-c=
olor: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: s=
olid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint=
"><div class=3D"subprettyprint"><font color=3D"#660066">if(some_error) {<br=
>=C2=A0 if(log.debugEnabled()) {<br>=C2=A0 =C2=A0 log.logDebug(&quot;Error =
was: &quot;, some_error, someErrorMessage());<br>=C2=A0 =C2=A0 return some_=
error; //Oops, should be in outer scope!<br>=C2=A0 }<br>}<br><br></font></d=
iv></code></div><div><br></div>Or this bug:</div><div><span style=3D"color:=
 rgb(102, 0, 102); font-family: monospace; background-color: rgb(250, 250, =
250);">if(some_error) {</span><br style=3D"color: rgb(102, 0, 102); font-fa=
mily: monospace; background-color: rgb(250, 250, 250);"><span style=3D"colo=
r: rgb(102, 0, 102); font-family: monospace; background-color: rgb(250, 250=
, 250);">=C2=A0 if(log.debugInfo()) { //Opps wrong level!</span><br style=
=3D"color: rgb(102, 0, 102); font-family: monospace; background-color: rgb(=
250, 250, 250);"><span style=3D"color: rgb(102, 0, 102); font-family: monos=
pace; background-color: rgb(250, 250, 250);">=C2=A0 =C2=A0 log.logDebug(&qu=
ot;Error was: &quot;, some_error, someErrorMessage());</span><br style=3D"c=
olor: rgb(102, 0, 102); font-family: monospace; background-color: rgb(250, =
250, 250);"><span style=3D"color: rgb(102, 0, 102); font-family: monospace;=
 background-color: rgb(250, 250, 250);">=C2=A0 }</span><br style=3D"color: =
rgb(102, 0, 102); font-family: monospace; background-color: rgb(250, 250, 2=
50);"><span style=3D"color: rgb(102, 0, 102); font-family: monospace; backg=
round-color: rgb(250, 250, 250);">}</span><br><br></div>I don&#39;t know ho=
w to solve this problem. Essentially you would need some kind of built-in p=
re-conditions on function calls.</div><div><br></div><div>Maybe something l=
ike this?</div><div><br></div><div><div class=3D"prettyprint" style=3D"back=
ground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-=
style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"pre=
ttyprint"><div class=3D"subprettyprint"><font color=3D"#660066">class Logge=
r {<br>=C2=A0 template &lt;typename... A&gt; void logDebug(A&amp;&amp;... a=
) &lt;- (this-&gt;debugEnabled());<br>};</font></div></code></div><br>The &=
lt;- syntax here defines a pre-condition. The rules might work like this:</=
div><div><br></div><div>* Evaluate only the subset of function arguments wh=
ich appear within the expression &lt;-() (same unspecified order rules as n=
ormal for the subset)</div><div>* If &lt;-() expression evaluates to true:<=
/div><div>=C2=A0 * Evaluate remaining arguments (same unspecified order rul=
es as normal)</div><div>=C2=A0 * Call the function</div><div><br></div><div=
>For functions with return values, you&#39;d need to somehow specify what i=
t returns if the precondition check fails.</div><div><br></div><div>Or mayb=
e another approach is to have some kind of unevaluated inline perfect forwa=
rding?</div><div><br></div><div><br></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/6adcf080-da93-4dca-b148-d5cbc9ce496e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6adcf080-da93-4dca-b148-d5cbc9ce496e=
%40isocpp.org</a>.<br />

------=_Part_780_1739752636.1494004355689--

------=_Part_779_565108504.1494004355688--

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Fri, 5 May 2017 13:30:40 -0400
Raw View
--001a11478078ce5860054eca4038
Content-Type: text/plain; charset=UTF-8

On Fri, May 5, 2017 at 1:12 PM, Matthew Fioravante <fmatthew5876@gmail.com>
wrote:
>
> I don't know how to solve this problem. Essentially you would need some
> kind of built-in pre-conditions on function calls.
>

The discussion in the other thread would address this also.  Allow
functions to have lambda-like parameters (I like having them be annotated
with []).  Then the function can evaluate the parameter at its discretion.

--
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/CAHSYqdY8%3DRX20tLoBWLU7fM0FCw7JxkXgEmq0RMy92O5neEiDg%40mail.gmail.com.

--001a11478078ce5860054eca4038
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On F=
ri, May 5, 2017 at 1:12 PM, Matthew Fioravante <span dir=3D"ltr">&lt;<a hre=
f=3D"mailto:fmatthew5876@gmail.com" target=3D"_blank">fmatthew5876@gmail.co=
m</a>&gt;</span> wrote:<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=
>I don&#39;t know how to solve this problem. Essentially you would need som=
e kind of built-in pre-conditions on function calls.</div></div></blockquot=
e><div><br>The discussion in the other thread would address this also.=C2=
=A0 Allow functions to have lambda-like parameters (I like having them be a=
nnotated with []).=C2=A0 Then the function can evaluate the parameter at it=
s discretion.=C2=A0</div></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/CAHSYqdY8%3DRX20tLoBWLU7fM0FCw7JxkXgE=
mq0RMy92O5neEiDg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHSYqdY8%3DRX2=
0tLoBWLU7fM0FCw7JxkXgEmq0RMy92O5neEiDg%40mail.gmail.com</a>.<br />

--001a11478078ce5860054eca4038--

.


Author: Matthew Fioravante <fmatthew5876@gmail.com>
Date: Fri, 5 May 2017 10:35:08 -0700 (PDT)
Raw View
------=_Part_602_1332247154.1494005708080
Content-Type: multipart/alternative;
 boundary="----=_Part_603_1798134985.1494005708080"

------=_Part_603_1798134985.1494005708080
Content-Type: text/plain; charset=UTF-8



On Friday, May 5, 2017 at 12:31:02 PM UTC-5, Hyman Rosen wrote:
>
> On Fri, May 5, 2017 at 1:12 PM, Matthew Fioravante <fmatth...@gmail.com
> <javascript:>> wrote:
>>
>> I don't know how to solve this problem. Essentially you would need some
>> kind of built-in pre-conditions on function calls.
>>
>
> The discussion in the other thread would address this also.  Allow
> functions to have lambda-like parameters (I like having them be annotated
> with []).  Then the function can evaluate the parameter at its discretion.
>

Some kind of auto-generate lambda parameter feature like that would solve
this use case quite nicely. I Like it.

--
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/683eabae-0fd2-4b4e-bfd1-2c8fc44469c8%40isocpp.org.

------=_Part_603_1798134985.1494005708080
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Friday, May 5, 2017 at 12:31:02 PM UTC-5, Hyman=
 Rosen wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
<div><div class=3D"gmail_quote">On Fri, May 5, 2017 at 1:12 PM, Matthew Fio=
ravante <span dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf=
-obfuscated-mailto=3D"DFt4nhfYBAAJ" rel=3D"nofollow" onmousedown=3D"this.hr=
ef=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javasc=
ript:&#39;;return true;">fmatth...@gmail.com</a>&gt;</span> wrote:<blockquo=
te class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc so=
lid;padding-left:1ex"><div dir=3D"ltr"><div>I don&#39;t know how to solve t=
his problem. Essentially you would need some kind of built-in pre-condition=
s on function calls.</div></div></blockquote><div><br>The discussion in the=
 other thread would address this also.=C2=A0 Allow functions to have lambda=
-like parameters (I like having them be annotated with []).=C2=A0 Then the =
function can evaluate the parameter at its discretion.=C2=A0</div></div></d=
iv></div></blockquote><div><br></div><div>Some kind of auto-generate lambda=
 parameter feature like that would solve this use case quite nicely. I Like=
 it.=C2=A0</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/683eabae-0fd2-4b4e-bfd1-2c8fc44469c8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/683eabae-0fd2-4b4e-bfd1-2c8fc44469c8=
%40isocpp.org</a>.<br />

------=_Part_603_1798134985.1494005708080--

------=_Part_602_1332247154.1494005708080--

.