assert semantic change proposal
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Sun Aug 3 15:15:55 PDT 2014
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. 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.
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.
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.
Andrei
More information about the Digitalmars-d
mailing list