But then why did you add your contract system to D? You implemented your contract system in the "early 90's", and D was released in 2001, so that's near a decade of "nobody wanted it". So then why add them as a core language feature of a new programming language if no one wanted it? Why is it still a core language feature? And why object to C++ finally adding contracts. I just don't get what you're even arguing here.
It's a great question! I simply had faith that it was a good idea.
The reason I started D in the first place is the C++ community was uninterested in any of my ideas for improvement. Ironically, C++ would up adopting a lot of them one by one! Such as contracts!
Contracts did find an enthusiastic constituency in the D community.
Contracts are a good idea, but I find the implementation of them to be clunky. I'd much rather contracts be part of the type system than as function signatures. Using the example in your earlier link, instead of defining day's 1..31 range within the Date-struct invariant, you'd instead declare a "day" type that's an int whose value cannot exceed 31 or be less than 1. This would be checked and enforced anytime a variable of the type is [re]assigned, set as a field, or passed-in as a parameter.
It should copy Zig's '= undefined;' instead of D's '= void;' The latter is very confusing: why have a keyword that means nothing, but also anything? This is a pretty common flaw within D, see also: static.
Nobody in D was confused by `= void;`. People understood it immediately.
> why have a keyword that means nothing, but also anything?
googling void: "A void is a space containing nothing, a feeling of utter emptiness, or a legal nullity, representing a state of absolute vacancy or lack."
"People" doesn't include me then. I had no idea that D had this feature for quite some time, despite using it fairly often in Zig, because when considering what the equivalent would be to search for, my brain somehow didn't make the leap to the keyword that represents literally nothing. Or as your Google search result says, "representing a state of absolute vacancy or lack." A less inappropriate use of "= void;" would be to zero-out something. I honestly find D's continual misuse of keywords like this to be really off putting and a contributing factor as to why I've stopped using it.
Yup, I keep mine enabled at all times. Anytime I've tried selectively disabling them, I get burnt with increasingly intrusive ads. I might be convinced to enable some kind of "ethical ads" filter that only permits ads are known to be unobtrusive and not track, but then you need to trust that whoever maintains that list wont succumb to incentives.
Not OP, but one example where it is a bit harder to do something in Rust that in C, C++, Zig, etc. is mutability on disjoint slices of an array. Rust offers a few utilities, like chunks_by, split_at, etc. but for certain data structures and algorithms it can be a bit annoying.
It's also worth noting that unsafe Rust != C, and you are still battling these rules. With enough experience you gain an understanding of these patterns and it goes away, and you also have these realy solid tools like Miri for finding undefined behavior, but it can be a bit of a hastle.
Except that's not really true, is it? It may be the flavour-text of US tradition that the government is protecting your rights rather than bestowing them, but the outcome is the same. Nor is the US government particularly fastidious about protecting them: one need only ask the average person of colour whether they feel equally protected under the law.
It is your Declaration of Independence that recognises inalienable rights endowed by one's creator, not the Constitution, and is thus legally unenforceable. We know this because none of the rights enshrined in the Constitution are actually inalienable. For example: the First Amendment says that Congress can make no law prohibiting the right to peacefully assemble... but then how does federal incarceration work? The US has one of the largest mass-surveillance apparatuses in the world despite the Fourth Amendment. The President has also attempted to end birthright citizenship via decree, something which your Supreme Court is currently entertaining instead of immediately overturning as patently unconstitutional.
There's a common refrain that rights do not exist without remedies. Whether rights are given by one's deity or by one's government is immaterial: if you cannot remedy a violation of a right, that right does not exist. While I can certainly agree that certain systems do not entrench rights as much as they should (here in the UK, all our rights persist at the whims of a simple majority), words on a page matter less than access to remedies.
Any president can go insane and go against the country’s principles. Nobody is perfectly safe from that. The issue with the constitution and declaration is intellectual: it takes centuries to completely override them. And when the president does go insane, you have the whole intellectual apparatus working against him. It is something, not just a nonexistent “remedy.”
To completely override them? Sure, but that's an odd criterion since one of the US's biggest issues is the unequal protection of rights. I have never seen a society so rhetorically obsessed with individual rights and freedoms, and yet so submissive to authoritarianism that failure to "just comply" is enough to justify summary execution in the streets (eg: Alex Pretti and Renée Good).
Again, this post is about Canada attempting to pass a bill to facilitate mass surveillance, which "freediddy" (yikes name btw) responded to by expounding upon the loftiness of American constitutional rights, as if America is not one of the most extreme mass surveillance states. It's as if Canada's attempt to pass the bill is more offensive than the mass surveillance itself, ie, it's just virtue theatre.
Oh that's just human nature: there's a reason why trashy tabloids continue to exist despite how public sentiment seems to universally agree that they're awful spreaders of rumour and insecurity. More people are Skankhunt42 than we'd like to admit.
Sure, just be aware of what you're up against: if religion teaches us anything it's that even concerted, systematic efforts over millennia to conquer human nature (eg: libido) still fail. But if you want to give it a go, by all means: one can only imagine Sisyphus happy.
One problem is that such information can be useful for non surveillance purposes, for example: how they knew certain roads were congested before GPS was the mobile networks. I personally do not see anything nefarious about this, nor would I necessarily wish to see this kind of information as uncollectable. Such things are different from tracking specific individuals, yes, but it's not that different. It then becomes a matter of what, how much, and for what purposes the information can be collected, which can be somewhat moot since the government in all likelihood will give themselves an opt out anyway.
None of this is to say that we shouldn't try, or that it's futile, but rather that it's a daunting task: the only way to really defeat this is to not only regulate private entities but also the government itself. And the only way to do that is to make such surveillance political suicide. And the only way to do that is to get the people to care about privacy. Here in the UK, the public has more or less come to accept CCTV cameras being everywhere, with the government now introducing AI face-scanning cameras, which has not been met with much public resistance. And so I do have to echo what @everdrive said: "We've done this to ourselves". Whether it's about convenience or apathy or whatever, we've had the means to object to this and we haven't.
reply