On Sunday, 3 August 2014 at 22:15:52 UTC, Andrei Alexandrescu
wrote:
On 8/3/14, 2:57 PM, John Carter wrote:
On Sunday, 3 August 2014 at 19:47:27 UTC, David Bregman wrote:
Walter has proposed a change to D's assert function as
follows [1]:
"The compiler can make use of assert expressions to improve
optimization, even in -release mode."
Hmm. I really really do like that idea.
I suspect it is one of those ideas of Walter's that has
consequences
that reach further than anyone foresees..... but that's OK,
because it
is fundamentally the correct course of action, it's
implications
foreseen and unforeseen will be correct.
Agreed.
I hope that agree was referring to some bits from the other
paragraphs, and that you don't seriously agree with that
blatantly self contradictory statement about unforseeable
unforseens :p
One related point that has been discussed only a little is the
competitive aspect of it all. Generating fast code is of
paramount importance for D's survival and thriving in the
market. Competition in language design and implementation is
acerbic and only getting more cutthroat. In the foreseeable
future efficiency will become more important at scale seeing as
data is growing and frequency scaling has stalled.
Would you care to address the questions about performance raised
in the OP?
Availing ourselves of a built-in "assert" that has a meaning
and informativeness unachievable to e.g. a C/C++ macro is a
very important and attractive competitive advantage compared to
these and other languages.
Not really, you can redefine the C macro to behave exactly as
proposed, using compiler specific commands to invoke undefined
behavior. Didn't you say in the other thread that you tried
exactly that?
Walter has always meant assert the way he discusses it today.
Has he (and subsequently he and I) been imprecise in
documenting it? Of course, but that just means it's Tuesday.
That said, should we proceed carefully about realizing this
advantage? Of course; that's a given. But I think it's very
important to fully understand the advantages of gaining an edge
over the competition.
Please comment on the concerns raised by the OP.