Hacker Newsnew | past | comments | ask | show | jobs | submit | foomatic's commentslogin

Guy shouting fuck you pig while surrounded by 50 SWAT guys sounds like a mental health emergency. Can't do much about that. Ain't called first respondersfor nothing.


I mean, you can, but everyone involved has already ruled out doing any kind of root cause analysis because they don't like the obvious solutions to the causes, so both "gun" and "mental health emergency" and "shooting by police" are treated as natural events like weather that we cannot hope to understand or control.


>sounds like a mental health emergency

Sure, you can dose him up with Haldol and solve that particular emergency. What happens when he does it again next week? And the week after that?

Persistent severe mental illness is interesting in that it's a new problem. For all of human history, severe mental illness was a death sentence. Either you'd get beaten to death by your largest neighbor for acting weird, or your village would exile you and you'd starve to death in the forest.

The current compromise we've arrived at is that being crazy is not actually a crime, so you cannot be permanently imprisoned for it. So low-functioning schizophrenics cycle through mental hospitals-- they climb a lamp post and urinate on passers-by, get committed and then are put on antipsychotics, sober up, survey their surroundings and rationally conclude that inpatient mental health facilities are really awful places to be, (basically no rights or privacy, surrounded by crazy people, can't wear or handle any object that's on a very short list of approved suicide-incompatible things) and then check themselves out, which they are legally allowed to do. Then they go off their meds, (also legally allowed) and it's back to the lamp post...

This continues until they accidentally walk into traffic, or are shot by a cop. It's a miserable compromise that persists because all the alternatives are even less palatable.


Follow up response -- the meth epidemic seems to be manufacturing craziness at a rapid clip. Our current "solution" is failing us and we'd be well-served to reexamine how to deal with it.

The correct answer is to legalize, tax, and regulate all drugs and to create "mental health courts" that can administer the involuntary institutionalization of those that need it.


We need to take another try at involuntary institutionalization of the mentally ill.

It should be cheaper than prisons and more humane as well. The homeless crisis begs for this.

Just got to work out trivial details like how to not have that power be abused...


Second comment because I was responding without addressing your point properly: somebody in a crisis like that could possibly be helped if there weren't 50 SWAT guys eager to take target practice.

There's obviously violent scenarios that can only be addressed with violence, but bringing that on should be a last resort.


Putting someone already in crisis into a dangerous situation (surrounding them with SWAT) is going to make the crisis much worse. The film we see of people having a mental health crisis always comes from after the cops have shown up; they may have been much less agitated beforehand.


Yep. There are "simple" things we can do that will make things better but that can't happen until we agree to do it.

And for that to happen we need to understand it.

And for that to happen we need to talk about it.


Yeah, suicide by cop is a thing.

My point was that the comment about divisiveness between teams red and blue in this regard was divisive as well in how it was framed.

Police are granted incredible powers and have historically not had the best oversight, let alone relations with "minorities".

There are real problems and they can be addressed but that will never happen as long as we can't even agree that the "what" exists, let alone if the "how" is correct.


What?


Why not just hire good people and ask them to learn C++. I mean how the heck did anyone actually pass this magic barrier of becoming a "C++ dev" in order to get hired as a C++ dev?


Because, little by little, C++ became "unlearnable".

Long ago C++ made C a little bit more complex. Because there were already lots of C programmers that wasn't a big deal.

But then it didn't stop. Little by little C++ grew into a monstrosity. A lot of people went along. I gave up.

For new programmers to climb in 2-3 years a mountain that seasoned programmers took 15-20 years to climb is asking too much.


It's not _that_ complicated these days. structs, classes strings, vectors, hash maps, unique_ptr, references, non-owning pointers where it makes sense, basic templates. Boom. You also need basics like ownership, order of construction/destruction, value categories, move semantics, special member functions, RAII, etc. All the fancy perfect forwarding and template magic are wrapped up in libraries most don't need to think to hard about. Most people rarely write code that actually manages resource lifecycle directly. It's all wrapped up in RAII.

If you read the whole spec, it looks super complicated. But getting to a mental model that works in 99% of cases is not _that_ hard.


In what world is C++ harder to learn than Rust?


This world - the one you exist in right now. I say that as someone that wrote C++ for 10 years before moving to Rust.

Rust was by far easier.

That said - that’s an extremely biased statement and I recognize that. I think it was largely the compiler that helped make it easier.


I think have 10 more years of programming experience probably makes it easier to pick up a new language


I'd argue that your parent is right. In the superficial sense, of learn the syntax and can spit out code.

That said code in C++ would just vomit cryptic messages about templates and SEGFAULT nearly all the time.

What I'm trying to say skill floor - minimum skill/time needed to learn something to do it however in Rust is higher than C++. Although not in the sense of you must be this smart to enter, but you need this much time to learn it. If I can learn it, and I'm a mediocre programmer it's not an issue of skill.

That said skill ceiling - skill needed to do it efficiently and without error is much higher in C++ than in Rust.


Speaking as someone for whom programming is only ancillary to my job and who previously use python as my primary language, I wouldn't touch C/C++ with a 10-foot pole simply because I don't trust my own abilities to not screw it up and don't have the time to put into learning them to a level where I know I'm not.

Things that Rust does that makes things easy for me as a less-experienced non-systems programmer:

- very good documentation and compiler errors

- cargo makes dependency management and distribution a breeze (big plus over python)

- footguns are easily recognizable and avoided (unsafe)

- strong typing allows me to express more invariants in the type system which makes my code easier to reason about (another big plus over python)

The borrow checker can be an impediment at times and I'm probably leaving some performance at the door by generally avoiding references in data structures. I've found that this is less of a problem over time. It can also be way more verbose. But I have way more confidence that things will work at the end of the day, which makes it worthwhile for me, even if on the surface it is take longer and be harder to write than python.


Rust isn't actually that complicated and more importantly, most of it makes sense. I don't feel the same way about C++.


I feel that C++ makes sense.

It doesn't actually make for a good argument.

C++ makes more sense to me than Go or PHP. And probably Python.


For the vast majority of programmers who don't know either. learning how to write correct Rust is easier than learning how to write correct C++.


Cargo is the number one feature of Rust that makes it easier for a newbie to use. New users of C++ struggle the most with building and linking projects together. Cargo makes that newbie proof. Source: I teach C++ and Rust to new programmers, and they almost universally get further, faster with Rust than C++.


Meson has improved the build situation in C++ significantly.


Kind of, but it also exacerbates one of the problems with C++ build systems which is there are so many and none of them are the build system. On one hand this is desirable from the perspective that it avoids monoculture. But it's a bad thing from the perspective of a new programmer in that it causes a lot of confusion and a form of "choice paralysis", where programmers become overwhelmed by options and choose nothing out of a fear of making the wrong choice.


I concede that the Rust tooling is miles ahead no question.


Time to write a program that compiles and seems to do what it does: Takes ages longer in Rust, unless you're experienced.

Time to be reasonably sure your multi-threaded code won't crash randomly: Takes ages longer in C++, even if you're experienced.


Rust exists in a way to point out that C++ is waaaaaaaayyyyyy harder than it looks.


There is C++ code that 99.999% of people that list C++ in their resume are unable to explain.

You can get comfortable with some idioms of C++, that's fine. Can you understand what any valid C++ code means? No. Such person does not exist, not even Bjarne.


You can say the same of any language. Deobfuscation is a hard problem. Only code meant to be reasonably understood is a valid comparison.


I don't mean obfuscation, I mean features of the language and their interactions.

C++ is a mine field. You need to learn where all the mines are and spend your day carefully walking around them.


Sure, but that's not what you said. If what you meant is that there is no one that can read anh more or less reasonably written code in C++, then I believe you'd be wrong.


I was scared of C++ but Rust offered me some confidence to start.

Some languages (like C) are easy but using them is hard.


Just cus they add a feature to a language doesnt mean u have to use it. Though it does seem very few programmers are smart enough to stick to the most basic features whenever possible.


One problem here is that everyone ends up with their own little niches of the language that they like, and nobody's code looks like anyone else's, and suddenly to read a codebase you do need to know huge swathes of the sprawling language.

At lastjob, we did a lot of C++, and I could tell whose code I was reading without checking blame because I knew who liked what idioms and features.


This is so true. Two examples.

1. I got a couple of downvotes a few days ago because I commented that I don't like the &s of Elixir (kind of shortcuts for 'fn x ->') and I prefer to write the full form as it's easier to read for everyone no matter how proficient in the language (zero to expert.) I also don't like and almost don't use the & shortcuts in Ruby (positional arguments.)

2. I got a customer recently with the lead developer fond of each_with_object. I never saw that in 17 years of Ruby and I had to check the reference. It's probably faster than the naive implementation (more time inside the C implementation doing real work vs inside the C parser?) but the naive one is immediately readable by anyone.


> One problem here is that everyone ends up with their own little niches of the language that they like

Amusingly, this was always the criticism I've seen leveled at Lisps over the years. It's just as true in C++ for sure.


Wouldn't that mean there should be no competing crates, because people should write the same code for the same task?


> Just cus they add a feature to a language doesnt mean u have to use it

While I absolutely agree with this in general, in practice with C++ if you're trying to use it safely you do in fact need to use those new features. But the old features are all still around too. It's a very, very large language in terms of mental space required these days.


C++ the "language culture" unfortunately has a lot of gatekeeping as well. The fact that the gatekeeping generally revolves around "replace feature from n-5 years with the newer feature in the latest 0x00x release" is a bit tiresome.

Yes, I'm exaggerating, a bit.

As for the Microsoft whomever-he-is: I agree in theory, I disagree in practice. If there are a lot of C++ devs writing important code, then let them continue to do so in their prime language that they've invested decades of hard work keeping up with the feature treadmill. New devs? Only if you have to.


> "replace feature from n-5 years with the newer feature in the latest 0x00x release"

Let me put a more pro-C++ spin on that sentiment.

C++ is a language that's under long-term development. It might sound weird, but only with C++20 Bjarne Stroustrup felt that his vision for the language was now mostly-realized - and he had worked on it since the 1980s. With other languages, there's a lot of clearing-of-the-desk and starting things anew, while C++ has opted for incremental changes with backwards compatibility to before it existed (i.e. C).

But, looking back, we get the sentiment you describe. Which, rephrased, sounds like this:

"Remember that annoying and ugly hack you had to use so far to get [complex thing] to work? Well, that finally got fixed. Now there's a shiny new language feature / standard library construct which does that more nicely. But your existing code will also work."


Agree 100%. The C++ language and ecosystem shouldn't feel dynamic, given its age and the installed base, and yet it really does. I remember when c++11 came out and all the crazy typedefs I had to type out just disappeared overnight, and I was able to write statements like "using Elem = uint64_t; using Node = MyClass::Node<Elem>;" which were so much more straightforward. Function pointers disappeared too and were replaced by lambdas so I could write my own "each_node" functions and actually have them be really useful.

Then we had concurrency primitives, and now apparently there's a module system in c++20 which should be interesting. C++ clearly has no plans to bow out gracefully or otherwise go quietly into the night, which is fine by me since I still think it's the language which gives me, as a developer, the most freedom and control over the system.


"but only with C++20 Bjarne Stroustrup felt that his vision for the language was now mostly-realized"

So... let me ask you given this statement. Let's say there is an uber smart super productive programmer who states: I can rewrite the entirety of the ecosystem of one language in 1 year....

Would you tell them to rewrite all C/C++ in C++20

or

Rewrite it in Rust?

C++'s only real advantage in the current language marketplace is an installed library base. But how much of that is C++0x2020? Is the barrier to entry of a new programmer in C++ not just 40 years of language revisions, but a massive massive map of libraries where JSON library uses features from v2016, while XML library uses v2005, while some multithreading thing uses v2020...

And then there's the STL, and mixed-in-C standard library, ye gods.

Will Rust turn into that? Well, I think it kind of will to some degree as they try to find dialects that perfectly describe borrower checker semantics. Rust is a syntax soup almost on par with C++, but I guess we'll see.


> Would you tell them to rewrite all C/C++ in C++20 or Rewrite it in Rust?

Neither.

1. I wouldn't trust a person who says something like that. It takes a programming luminary several years to write a good (non-trivial, not-tiny) library the community can get behind, and even that usually involves iterations of use, feedback and partial rewriting/redesign.

2. Why would we want a "rewrite of the entire ecosystem" (whatever that ecosystem may be) all at once? That's a fiasco waiting to happen.

3. An "ecosystem" very often needs to be at least somewhat backwards-compatible, so I wouldn't want it written in something that's just out of the nylons.

Probably best to let that smart programmer write some decent foundational libraries which we can adopt one at a time, with increasing benefit of synergy.

> C++'s only real advantage in the current language marketplace is an installed library base

That seems untrue. C++ has various capabilities in different usage scenarios which other languages do not. But more importantly - programming languages don't all compete: They typically have different combinations of design goals. That's specifically true of C++ vs Rust.

> But how much of that is C++0x2020?

That doesn't matter much. For you, anything that's not written in the latest version of a language may be irrelevant/unusable. Not for the users of backwards (and forwards-) compatible languages like C, C++ and various others.

> Is the barrier to entry of a new programmer in C++ not just 40 years of language revisions

No, 40 years of revisions is not a barrier to entry. Your saying that makes it sound like you are not very familiar with the language.

> mixed-in-C standard library, ye gods.

double x = sqrt(x_squared);

... oh, the humanity! Who would ever write something like this? It's a non-polymorphic function and its symbol doesn't get mangled! Ye gods!


A vision that ironically is only fulfilled by Visual C++, and who knows when GCC and clang will manage to reach it, specially in what concerns modules.


This is a common fallacy imho that if I am a good dev, I can easily cross-train.

I have been writing C# almost exclusively for around 20 years and I am still learning tricks/tips/gotchas and not just for new language features. That is why my experience is important. Even in something like Java which looks very similar to C#, it takes a long time to work out what works differently, good patterns and idioms, the correct libraries that everyone uses for stuff etc. even when I know what I am looking for.

When I looked at Rust, I got some of it because I have previously written C and C++ and didn't have a problem with the concept of pointers or references but it still took me several weeks to get a basic example working and I had to ask on a forum in the end.

So yeah, not easy!


Cause those person-hours have to come from somewhere.

Am I spending 2x of the new hire's time making them learn a harder language? Am I spending 2x of a senior's time teaching the new hire?

What's the payoff in sticking with C++? Better libraries? Better tools? IDEs? That stuff will all shift as time goes on, if popularity is against it.


What's the equivalent in Rust to Eigen, Ceres Solver, OpenCV, JNI and Qt UI bindings?

This is my standard stack for C++ and last time I checked Rust couldn't do any of them. This is also my standard stack for building new open source computer vision libraries, growing the available libraries and making my field more locked into C++, increasing the moat Rust would need to cross.

Next step, can I compile and deploy for Windows, macOS, Linux, Android and iOS? All of these are critical business requirements. This is whether I can adopt Rust in my employer's codebase.

Finally, can I easily find and hire engineers who can read and write Rust who aren't asking FAANG compensation levels? This is the blocker for Rust in startups.


Deploying for Windows, macOS, Linux, iOS and Android is way easier with Rust than C(++), because there's one build system and one standard library that supports them all without #ifdefs. The ecosystem takes first-class Windows compatibility seriously instead of having a unix and windows dialects and the unix side saying MS sucks and it's your problem it doesn't compile.

The worst part about Rust's cross-platform compatibility and cross-compilation is Rust's dependence on a C linker and C/C++ dependencies if you choose to use them.


Modern C++ has cross platform threads, filesystem access, etc. Unless you're actually trying to use platform specific technology, there's no need for #ifdefs.

For the most part CMake handles the cross platform toolchain issues, so it's just one flag to turn on Release Vs Debug builds, enable LTO, include dependencies etc. Again, it's just platform specific features that require if...endif sections.

The complaints I'm seeing here would be the equivalent of me complaining about Rust's garbage collection, the only difference is that Rust broke everyone's code in removing it while C++ managed to keep almost everything since the 1980s still working.


Robert C Martin's book about software architecture made a point about the fleeting nature of software as a product.

Time goes on, business changes and computers become faster.

At some point, many developers started to see features like a garbage collector, become a good offer with few disadvantages.

Unless we really need the performance, do users really care if the program consumes a few cycles more, if those cycles are being spent on tools to make lives easier for developers, like a garbage collector?

90% of software wouldn't make sense to be written in C


My point was a good coder / CS person is going learn either twice as fast as average one, bad one not at all.


Because “just hire good people” is on par with “just hire good pilots”. Easier said than done.


It's also expensive. Every industry has focused on changing the environment so average people can do good work rather than fight over the top 5% of talent.


I guess Java would be the counter example to this.


Um no. A closer analogy would be like hiring a good 737 pilot for 777 instead of someone with thousands of hours on the 777.


I mean I could learn C++, but I don't wanna. I did some of it back in school (game development) and I don't particularly care for it. I don't want to do memory management myself or even have to worry about it.


Sounds like software design process done poorly


Can you elaborate on that?


Code comments are implicitly associated with code that already exists. Sounds like your making a presumption about what code exists and potential missing the forest for the trees.


Sorry what?


I think what he's trying to say is that ageism is real today, but things didn't used to be that way.


I don't feel better. What hope is there for me then!? Fuck-em and their stupid snobby jobs anyway.


It makes me think that the r/cscareerquestions tack of forgetting everything else and focusing on just leetcode may actually have merit.

For what it's worth, I think Chris Marshall looks like a great developer and a professional I aspire to emulate. However, a lot of companies do make decisions based on metrics, keyword searches, and standardized tests like leetcode (aka stuff that misses out on the human element), so it makes sense to try and balance both if one hasn't done so already.


I'm sorry.

There's no hope for me either; I'm not a "good cultural fit" most of the time.

I agree with your last sentence, although I would word it a little differently. :)


From your blog I expect that you'd be a cultural fit for the kind of place I'd like to work in. Unfortunately those places are not the that common.


Unfortunately, you're correct that they are not that common.

In fact, my last job was at a place where the salesman told me to not fix a bug I found until a customer ran into that bug so that "they'll remember why they need us." I was appalled.

I'm glad there are more programmers like me out there though. Thank you. :)


"useCallback" is not very intuitive naming. I'd guess a fair bit of the confusion could be attributed to this alone. Could have been useMemoizedValue useMemoizedCallback at least. The whole useXXX naming convention is also unintuitive.


Or the term "side effect" (especially in a language that does not enforce return types): https://dev.to/ruizb/side-effects-21fc


What does "compose much better" mean?


copy/paste from another comment:

Hooks compose, whereas side effects and memoized values sprinkled through component constructors and lifecycle methods do not.

For example, the equivalent of useEffect required calls inside of componentWillMount, componentDidUpdate, and componentWillUnmount. You try and make something like this re-usable and you’ll be leaking details of your implementation across the whole component via inclusion in these lifecycle methods, not to mention any data you’re shoving onto the component instance. But it’s still doable.

Now, what if you wanted to use this re-usable behavior inside of another re-usable behavior? It gets complicated fast! Now your library needs to expose the lifecycle-updating methods of the underlying library, leaking details all the way down. Hooks are opaque from the perspective of lifecycle, while still having access to all the same… hooks.


Oh ok. I'd agree Hooks compose much better then. But there was no attempt or consideration at compositional API for class based components besides getting rid of it entirely and then adding functions that hook into the nether nether.

> For example, the equivalent of useEffect required calls inside of componentWillMount, componentDidUpdate, and componentWillUnmount.

Yeah from what I recall this was the prime motivational example given in the React docs for introducing hooks. It's a legit problem. But hooks and getting rid of class based components is not the only solution. In classical OO are also well worn solutions along the lines of hooks, they just work with classes / objects with interfaces still. It's somewhat frustrating that this is never even considered.


> This can be contrasted with traditional market economies where large corporations start off as small companies and become dominant through innovation, growth, and generally meeting consumer demands.

Or when the govt sells off public assets ...


So useMemo === Vue's computed values??


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: