← Back to context

Comment by WalterBright

10 hours ago

I implemented Contracts in the C++ language in the early 90's as an extension.

Nobody wanted it.

https://www.digitalmars.com/ctg/contract.html

How do you know nobody wanted it?

  • > How do you know nobody wanted it?

    Some imperfect data points on how to judge if a language feature is wanted (or not):

    - Discussion on forums about how to use the feature

    - Programs in the wild using the feature

    - Bug reports showing people trying to use the feature and occasionally producing funny interactions with other parts of the language

    - People wanting to do more complex things on the initially built feature by filing features requests. (Showing that there is uptake on the feature and people want to do more fancy advanced things)

> Nobody wanted it.

The fact that the C++ standard community has been working on Contracts for nearly a decade is something that by itself automatically refutes your claim.

I understand you want to self-promote, but there is no need to do it at the expense of others. I mean, might it be that your implementation sucked?

  • Late nineties is approaching thirty decades ago; if the C++ committee has now been working on this for nearly a decade, that's fifteen to twenty years of them not working on it. It's quite plausible that contracts simply weren't valued at the time.

    Also, in my view the committee has been entertaining wider and wider language extensions. In 2016 there was a serious proposal for a graphics API based on (I think) Cairo. My own sense is that it's out of control and the language is just getting stuff added on because it can.

    Contracts are great as a concept, and it's hard to separate the wild expanse of C++ from the truly useful subset of features.

    There are several things proposed in the early days of C++ that arguably should be added.

    • I am not sure what the "truly useful features are" if you take into account that C++ goes from games to servers to embedded, audio, heterogeneous programming, some GUI frameworks, real-time systems (hard real-time) and some more.

      I would say some of the features that are truly useful in some niches are les s imoortant in others and viceversa.

    • > Late nineties is approaching thirty decades ago

      Boy, this makes me feel old... oh wait :)

      (I agree with your point; early 90s vs. mid-10s are two very different worlds, in this context.)

  • > I understand you want to self-promote

    Not a very fair assumption. However, even if your not so friendly point was even true, I'd like people who have invented popular languages to "self-promote" more (here dlang). It is great to get comments on HN from people who have actually achieved something nice !

  • In the early 1990s, C++ had not yet been standardized by ISO, so your argument doesn’t apply to that period.

it could be possible that llms can mak great use of them

  • > it could be possible that llms can mak great use of them

    This is actually a good point. Yes, LLMs have saturated the conversation everywhere but contracts help clarify the pre-post conditions of methods well. I don't know how good the implementation in C++ will be but LLMs should be able to really exploit them well.