uasi · 40 points · 27 comments · 2 hours ago · Open original
Comments
5 preview comments · loading full thread
Log in to use comments
Log in to h4cker, then connect Hacker News to publish comments.
GRgroos37 minutes ago
C++ is probably the largest, most complex programming language to ever exist. I, as a former C++ compiler developer, find it hard to keep up with the language changes. What chance does an average user have?
RUrurban28 minutes ago
This contracts design is good, opposed to Gudstedt's variant with the semicolon.
Because here it is trivial to make them backwards compatible, by just using a PRE() and POST() macro which are empty pre-C++26.
The contracts_assert is either static or runtime, which the compiler can decide. Better than explicit static/asserts, which are either unnecessary or costly.
QAqalmakka33 minutes ago
IMHO the current contracts are a half-baked feature that I suspect will immediately end up in most coding styles as "do not use contracts".
I understand the concept but having a feature that's not consistent among compilers, targets, ... all while doing absolutely nothing to solve the _real_ problems with C++. Like that the build model is still the obsolete TU model of C, while adding multiple compile-time features that inevitably end up causing build times to skyrocket considerably. Or that modules are still DOA after 6 years. Or that the syntax is full of bullshit anti-features that could be at least fixed by having a proper build model (like Rust) and editions (like Rust).
Having yet another feature that only works sometimes with quirky semantics is dumb and I understand why many people feel like it should be shelved to prioritise the features people _really_ care about, like meta
XIxiaoyu200651 minutes ago
I can only describe current C++ as a Frankenstein. Trying to introduce modern features while having to keep compatibility is just really hard and probably not "the right way".
WEweinzierl42 minutes ago
The simplified TLDR is that ISO for the very first time did not approve a proposed C++ standard.
9 out of 22 countries voted "no", six would have been enough.
These were Denmark, Finland, Iran, Italy, Japan, Luxembourg, Romania, Spain, and Sweden. In a addition and independently only 12 of the 20 participating members approved when 14 were needed.
The dispute is most likely because of a single feature called "contracts".
Very simplified these are conditions placed in a function's signature that are supposed to be checked at runtime.
The proposed implementation of this feature has been controversial from the start with prominent members of the community (Bjarne Stroustrup amongst them) expressing concerns.
Comments
5 preview comments · loading full threadLog in to h4cker, then connect Hacker News to publish comments.
C++ is probably the largest, most complex programming language to ever exist. I, as a former C++ compiler developer, find it hard to keep up with the language changes. What chance does an average user have?
This contracts design is good, opposed to Gudstedt's variant with the semicolon. Because here it is trivial to make them backwards compatible, by just using a PRE() and POST() macro which are empty pre-C++26. The contracts_assert is either static or runtime, which the compiler can decide. Better than explicit static/asserts, which are either unnecessary or costly.
IMHO the current contracts are a half-baked feature that I suspect will immediately end up in most coding styles as "do not use contracts". I understand the concept but having a feature that's not consistent among compilers, targets, ... all while doing absolutely nothing to solve the _real_ problems with C++. Like that the build model is still the obsolete TU model of C, while adding multiple compile-time features that inevitably end up causing build times to skyrocket considerably. Or that modules are still DOA after 6 years. Or that the syntax is full of bullshit anti-features that could be at least fixed by having a proper build model (like Rust) and editions (like Rust). Having yet another feature that only works sometimes with quirky semantics is dumb and I understand why many people feel like it should be shelved to prioritise the features people _really_ care about, like meta
I can only describe current C++ as a Frankenstein. Trying to introduce modern features while having to keep compatibility is just really hard and probably not "the right way".
The simplified TLDR is that ISO for the very first time did not approve a proposed C++ standard. 9 out of 22 countries voted "no", six would have been enough. These were Denmark, Finland, Iran, Italy, Japan, Luxembourg, Romania, Spain, and Sweden. In a addition and independently only 12 of the 20 participating members approved when 14 were needed. The dispute is most likely because of a single feature called "contracts". Very simplified these are conditions placed in a function's signature that are supposed to be checked at runtime. The proposed implementation of this feature has been controversial from the start with prominent members of the community (Bjarne Stroustrup amongst them) expressing concerns.