Live data from Hacker News

"No way to prevent this" say users of only language where this regularly happens

xeiaso.net

251–260 of 342 posts

Re: "No way to prevent this" say users of only language where this regularly happens

#251
post #240
post #205

Earlier quoted context omitted.

TIL almost every european country is in a state of tyrnanny. Also Yemen which is one of the only countries with somewhat similar gun ownership compared to usa (bit less than half as many guns per capita) must be the epitome of freedom and safety.

What about Switzerland? They have extremely liberal gun laws, on par with the USA. Perhaps it’s not the guns that are the problem? Perhaps it’s the overall dysfunction of the US as a country?

Although Switzerland does indeed have (by comparison to the rest of civilised countries) "Extremely liberal gun laws" and the higher deaths and injuries to match, it doesn't really compare to the US.

Re: "No way to prevent this" say users of only language where this regularly happens

#252
post #226

Earlier quoted context omitted.

Are you sure? The C sphere overlaps with the UNIX one, for obvious reasons.

I can't remember Linux zealots raving irrationally about C though (although when googling I'm sure something will come up). Topics like Wayland or systemd on the other hand, oh my...

I said UNIX culture, not Linux.

Diving into the ruins of Usenet, or UNIX/C literature, will provide enough examples.

Re: "No way to prevent this" say users of only language where this regularly happens

#253

Earlier quoted context omitted.

It's possible to write systematically safe code in C, no need to change language. People really just don't want to do it.

It's possible to write systematically safe code in assembly, no need to use any language. People really just don't want to do it.

When the language has builtin safety, it has better ergonomics, so there's merit in switching language.

Re: "No way to prevent this" say users of only language where this regularly happens

#254

Just in case someone needs the reference, the onion uses '"no way to prevent this" says only nation where this regularly happens' as a reoccurring article at every major school shooting[0], to highlight the frequency of such events and the fact that nothing has really changed since the last one. [0] https://www.theonion.com/no-way-to-prevent-this-says-only-na...

I find the Wikipedia article also a good summary of the "joke" and is quite chilling to read.

https://en.wikipedia.org/wiki/%27No_Way_to_Prevent_This,%27_...

Re: "No way to prevent this" say users of only language where this regularly happens

#255
post #91

Earlier quoted context omitted.

As someone just starting to finally learn Rust, I'm curious what some examples of this might be.

All AFAIK, since I only dabble occasionally in Rust: The borrow checker works on "struct granularity", but it would be much more flexible and convenient if borrowing would work on memory location granularity (for instance passing a struct reference into a function "taints" the entire struct as borrowed, even if that function only accesses a single item in the borrowed struct - this 'coarse borrowing' restriction then…

> There are also related restrictions about function call barriers. AFAIK the Rust compiler cannot "peek into" called function bodies to figure out what's actually going on inside those functions (and that information would be very valuable for fine-grained borrow checking), it can only work with the information in the function signature.

I don't think it's so much "can not" as it is "will not". Allowing the function signature to be determined by the body can lead to accidentally breaking callers by changing the body.

That, at least, is consistent with other parts of the signature: the input/output types and how the lifetimes of input/output references are related.

Re: "No way to prevent this" say users of only language where this regularly happens

#256

Earlier quoted context omitted.

What they suggest? What I and the discussed article claim is that safe code isn't written because programmers don't want it. CVEs aren't caused by desires, they are caused by unsafe code.

Many people suggest to start gradually migrating to either Rust or start investing much more seriously in formally proving C/C++ code (which is IMO a huge endeavor). As I said in multiple other comments, I know there are valid cases for C/C++ where various factors prevent migration. I am not playing a little rebel revolutionary here, I am addressing the people who can migrate away but refuse to do so based on hand-wa…

I didn't propose to migrate to rust.

Re: "No way to prevent this" say users of only language where this regularly happens

#257

Earlier quoted context omitted.

Many people suggest to start gradually migrating to either Rust or start investing much more seriously in formally proving C/C++ code (which is IMO a huge endeavor). As I said in multiple other comments, I know there are valid cases for C/C++ where various factors prevent migration. I am not playing a little rebel revolutionary here, I am addressing the people who can migrate away but refuse to do so based on hand-wa…

I didn't propose to migrate to rust.

You asked me a question, I replied.

Re: "No way to prevent this" say users of only language where this regularly happens

#258
post #64

Earlier quoted context omitted.

Eh, Rust would be fine if not for the fact that it's too opinionated. Unfortunately you can't just have Rust's safety checks, without opting into restrictions that Rust designers force onto You that aren't inherent to safety checks, but more because 'that's a better practice (according to us)'. And also, easy and fast iteration just isn't there, both because of borrow checker restrictions and compile times

C/C++ being non-opinionated is the main source of the security vulnerabilities. Let's face it, it felt good to be a lone cowboy carrying a lot of responsibility and knowing what you are doing. I was there myself and I'll admit the ego trip was awesome. These times are long past and naturally, people refuse to adapt. > Unfortunately you can't just have Rust's safety checks, without opting into restrictions that Rust d…

>Show me something that does better and I'll switch tomorrow.

There's no limit to perfection, but if you merely don't write C of opportunistic kind, logical errors quickly start to outweigh other types of errors.

Re: "No way to prevent this" say users of only language where this regularly happens

#259

Earlier quoted context omitted.

No way to prevent "this", says C++ programmer.

Just use Python it uses 'self'

In Python, you can easily just not type "self" (or whatever you named the 1st arg).

In C++, you can not not type "this", at least if you don't, "this" will be looked up anyway.

Re: "No way to prevent this" say users of only language where this regularly happens

#260
post #240

Earlier quoted context omitted.

What about Switzerland? They have extremely liberal gun laws, on par with the USA. Perhaps it’s not the guns that are the problem? Perhaps it’s the overall dysfunction of the US as a country?

Switzerland has very high rates of fun ownership, but their laws are far from lax. They are much stricter than the US. You need a permit to buy anything other than a hunting rifle. You can't buy a gun if you have been convicted of a crime, have an alcohol or drug addiction or express a dangerous attitude. You generally can't carry a gun except when going to and from hunting or a shooting range and you can't have the…

> You need a permit to buy anything other than a hunting rifle. You can't buy a gun if you have been convicted of a crime, have an alcohol or drug addiction or express a dangerous attitude.

...as opposed to the US? Do you think you can just buy a machine gun over the counter without any checks in the states?

Post reply on HN