<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I disagree for two reasons:<br>
<br>
1. enforce() generates so much code that it's likely that very few
compilers would inline it, and then also inline the function calling it.<br>
<br>
2. Even if enforce() does get inlined and the checks become cheaper,
IMHO ranges need to be a lightweight enough abstraction that there's <b>zero</b>
overhead in release mode, kind of like arrays (which are themselves
ranges). A major goal of ranges is that they are supposed to be an
extremely lightweight abstraction that can be used even in the most
performance-critical code.<br>
<br>
I generally agree with the view that input to a public API should be
checked come Hell or high water, but I think exceptions can be made for
things that are intended to be very efficient, lightweight
abstractions. Builtin arrays are one of these. Ranges should be
another.<br>
<br>
On 8/21/2010 7:19 PM, Brad Roberts wrote:
<blockquote cite="mid:4C705F13.4010202@puremagic.com" type="cite">
<pre wrap="">On 8/21/2010 2:29 PM, Andrei Alexandrescu wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On 08/21/2010 01:52 PM, David Simcha wrote:
</pre>
<blockquote type="cite">
<pre wrap="">It seems like the consensus here is that, for range primitives, assert()
is the way to go. I'd like to commit the changes in time for the next
release, but I'd like to have Andrei's nod first b/c he's been quiet
throughout this discussion and he's the main designer of std.range and
std.algorithm.
</pre>
</blockquote>
<pre wrap="">
Thanks - I feel like a mobster who's being given respect :o). I thought of this
a lot, and talked with Walter as well. Will get back with an opinion today.
Andrei
</pre>
</blockquote>
<pre wrap="">
The part I dislike the most is that this decision is being heavily influenced by
a dmd quality of implementation issue. Primarily, the inlinability of enforce
vs assert.
_______________________________________________
phobos mailing list
<a class="moz-txt-link-abbreviated" href="mailto:phobos@puremagic.com">phobos@puremagic.com</a>
<a class="moz-txt-link-freetext" href="http://lists.puremagic.com/mailman/listinfo/phobos">http://lists.puremagic.com/mailman/listinfo/phobos</a>
</pre>
</blockquote>
<br>
</body>
</html>