News for hackers. Stuff that matters.
Re:C++ Is the New Python by tialaramex on Wednesday July 14, 2021 @02:47PM (#27836805)
Maintenance matters. The C++ standard library provides some data structures you shouldn't use. OK, not some, C++ stdlib provides almost exclusively data structures you shouldn't use. But hey, the C++ language itself has some data structures you shouldn't use too (arrays especially).

However, Python's standard library is stuck with urllib, although these days they have the courtesy to tell any poor fool looking at the documentation that Requests exists, if you do use the standard library you get very primitive HTTPS handling, and so many wrong defaults.

Because these standard libraries have so many users, Hyrum's law means that you have to work very hard to fix anything.

Re:C++ Is the New Python by blub on Thursday July 15, 2021 @03:17AM (#27842187)
"C++ stdlib provides almost exclusively data structures you shouldn't use"

The containers according to [1] are array, vector, deque, forward_list, list, *set, *map, stack, queue and priority_queue. All of these are good general implementations that can and should be used for most C++ software.

Some classes of software require better performance or certain special guarantees and then it makes sense to consider specialized implementations.

[1] https://en.cppreference.com/w/cpp/container

Re:C++ Is the New Python by uranusjr on Wednesday July 14, 2021 @07:54PM (#27839924)
I think in urllib.request’s case (urllib.parse is fine albeit arguably with a cluncky API) it’s not they need to work very hard to fix it, but the task is impossible. My understanding is that bundling SSL validation in the Python stdlib is a lost cause since Python is updated way too infrequently and the stdlib cannot be easily changed once a Python minor version goes EOL, so they just gave up. If there’s anything Hynum in here, it’s they have their hands tied from removing the module entirely.
Re:C++ Is the New Python by Abishek_Muthian on Thursday July 15, 2021 @03:44AM (#27842329)
> although these days they have the courtesy to tell any poor fool looking at the documentation that Requests exists

Added up with "And when your project scales, Replace asyncio with uvloop, Coroutine with gevent, http.server with gunicorn and everything else with a cython based alternative".

Or personally I just say 'Use go instead' to someone who's just getting into programming for developing a project which could potentially scale.

Re:C++ Is the New Python by bsder on Wednesday July 14, 2021 @06:10PM (#27839067)
Exactly. Just look at the mess that is the C++ String.

This, of course, causes everyone to roll their own String, which is probably almost as bad.

So, now we have a zillion String libraries, all of which suck.

All because the C++ standard library doesn't provide a decent String.

Re:C++ Is the New Python by blub on Thursday July 15, 2021 @03:27AM (#27842231)
std::string is not a mess, it's a good general string implementation which should suffice for many applications. Its only sin is perhaps that it does not support Unicode.

If you look for example at other implementations like fbstring, the main benefit is performance.