logoalt Hacker News

kllrnohj • today at 12:59 AM • 3 replies • view on HN

Does the existence of PEP 572 not similarly result in being paralyzed and overwhelmed at the number of ways to do something being greater than 1?

C++ definitely has complexity, but I'm surprised by the two examples specifically chosen. Which pointer? C++ only has 2: unique_ptr and shared_ptr (or 2.5 if you want to include weak_ptr but that necessarily means you already chose strong_ptr first). While this might be a complicated choice if you're just comparing to Python, but it shouldn't be if you're familiar with Rust since Rust has you make the same choice.

And then "how should I iterate" is similarly the same as any other language? Either a for or a for-each loop?

There's definitely baggage from 38 years of lessons learned, to be sure, just those examples are odd choices


Replies

TheOtherHobbes • today at 1:52 AM

You've already mentioned four pointer types which are separate to the original plain vanilla pointer concept.

https://en.cppreference.com/cpp/language/pointer

When I started C++ nearly 15 years ago this was already a huge problem. I bought some books and looked up online references and after a while I discovered that both were already out of date.

C++ is a chimera. And it hasn't improved since.

Other languages are far more stable, conceptually. New features rarely undermine or reinvent the older ones.

C++ is unique in the way it keeps modifying its own core. There is no formal deprecation or EOL process, so the language is more like an archaeological dig than a living standard.

➕ show 1 reply
zzzoom • today at 3:20 AM

> And then "how should I iterate" is similarly the same as any other language? Either a for or a for-each loop?

for (ignoring do and while) and foreach loops, std::for_each, ranges for_each at the very least

➕ show 1 reply
StilesCrisis • today at 1:07 AM

Don't forget * (true pointer) and & (called a reference, more honestly a pointer that can't be repointed, except with UB it can _totally_ get repointed).

➕ show 2 replies