144 karma · joined July 24, 2023
This is true of all categories, so not a helpful comment. I suspect someone has a good enough definition.
I bet most EE graduates still couldn't provide a good interpretation of a transfer function or a Laplace transform.
> Generic code has proven itself time and time again, even Go caved in and supported it.
I'm not saying anything against the language feature generics. There is plenty of use for them even in a self contained code base.
Yeah, I forgot about that. So I agree there is some subtly which is likely to catch beginners.
Your example could safely be:
if (std::distance(begin, end) > 5)
Another approach I would recommend is to write a `guarded_advance` which takes an integer and the end pointer.Also note that the situation you are describing is still a little unusual because the baseline assumption is it takes linear time to advance an iterator by more than 1 increment.
> but neither will valid increment between two integers. No need for iterators in that case either.
The purpose of an iterator is to abstract data structure access. The coordinate inside a complex data structure may not be representable by an integer.
That's true. But simply having knowledge of the goal and a few simplifying assumptions can beat all the optimization in the world. In other words, a polished sub-optimal approach isn't as good as just having a better approach. `std::unordered_map` is heavily optimized, but can't make any tradeoffs because it's a general tool.
> plethora of generic C++ hash tables which would match, if not soundly outperform, their C counterpart.
Post one.
> not only is it possible to specialize generic code for particular types, but it's absolutely routine to do so.
Yep, it can do type base specialization, not application based specialization though. That requires a programmer.
> how do you explain qsort often being beaten by std::sort
a standard library C function often cannot be inlined to remove the comparison function pointer call, whereas std::sort trivially can.
If you wrote one yourself for a particular problem, it would not have this issue. This is actually a great example of where C excels because the choice of sorting algorithm so much depends on the kind of data you are sorting.
Let me be clear about my claim: tailor made solutions to each problem will almost always be faster than generic solutions. Do you really disagree with that? If you want to argue that maybe it's not productive to work that way, that's a different argument.
A program which constructs an AST out of python classes and spits out GPU code is a compiler. The python is never executed.
Trivially, compilers can generate code faster than their hose language, but that doesn't make the host language fast. The compiler would be even faster if it were written in C++.
What behavior is undefined in incrementing a pointer between a begin and end range?
> but you trust it to optimize all that garbage away?
Yep, if you learn about compilers you learn what kind of optimizations are easy and hard for them to make. The kind that just flattens a few levels of nested definitions are easier.
No, it almost always is. The designers of a generic library can't anticipate the use case, so can't make appropriate tradeoffs.
For example, compare `std::unordered_map` to any well written C hash table. The vast majority of hash tables will never have individual items removed from them, but a significant amount of complexity and performance is lost to this feature.
I also agree with that. The vast majority just aren't interested or did the minimum to pass classes, without really absorbing it.
What I disagree with is the self-taught correlation. The people who can do what you describe overwhelming are academically curious and have degrees.
> maybe getting the degree isn't necessarily the best path
I think you'll find a similar pattern in all fields. I think what's more in question is the ability of education to transform ingrained aptitudes and interests.
I can't help but think European perception is a little exaggerated here. Yes, the live on campus and party at age 18/19 experience is expensive. But, getting a state school degree on a budget, and maybe a year of community college? You're looking at 10-30k.
The bigger risk is opportunity cost since degrees start later and take longer.
I have only met one self-taught person who reads anything like this. My experience is exactly the opposite. Most self-taught programmers are great at programming and solving business problems, but tend to be less technical and think academic stuff is a waste of time.
> there can never be real progress ...
> without having a programming language that is powerful enough
Historically there have been plenty of interesting powerful languages on the periphery, but most of the useful stuff is not written with them.
Norms like being honest and not stealing? society gets really expensive and unfriendly when we have to use enforcement instead of norms.
OOP is just functions that are only polymorphic in 1 argument, when you want it on all of them.
- if you're young you probably want to be around others to learn from.
- if you're not well established, you want others to know you and see your impact.
- if you're struggling financially or to find a job, you probably don't want to compete with the whole world for basic employment (especially against low cost of living countries.)
So yes, if you just need a paycheck for skills you already have, and that can be done remotely, that can be convenient. If you are looking for more you need to consider these kinds of tradeoffs.
I agree, but the other choice is to have traditional threads of execution that block. This simple strategy has delivered more successful projects than any other.
> Alsop says that revenues will decrease over the next 4-5 years ‘given the demographic cliff’.