bregma 5 days ago

He's not writing the C++ standard library from scratch. He's writing his own library, in a different namespace, with some similar functionality. It's easy to write a non-standard library that only satisfies your limited subset of needs. People do it all the time. It's not special.

The ABI stability boast is based on having no legacy to support. It will work fine as long as everything is shipped only as code and the whole world needs to be rebuilt from scratch every time and even then, you never change any code ever even for a major bugfix. That's hardly practical in the real world where one tiny misstep on the ABI front can result in billion-dollar multinationals threatening suit (ask me how I know). It's a facile claim.

The C++ standard library hasn't been known as "the STL" for almost 30 years, ever since part of the STL was modified and adopted into the C++ standard library. Most of the features he's providing implementations for were never a part of the STL (file I/O, strings, hash maps, UTF-8).

I maintain an implementation of the C++ standard library for a living. It's a full-time job. It's a huge library (note to the committee: please stop) and it's really easy to mess something up. But if you want to write your own library that doesn't do what the standard library does or meet any of its requirements and implementation constraints or serve its real-world purpose, go right ahead. Just don't claim you're writing your own C++ standard library. You're not.

5
munificent 5 days ago

This is an unnecessarily combative comment.

The author doesn't claim to be implementing the C++ standard library. They clearly say they are implementing a C++ standard library.

It's obvious from the context that they mean a hobby-scale set of basic datatype and algorithm libraries. It would take an uncharatible reading to not realize that they mean a lowercase "standard library", not "conforming implementation of the ISO C++ Standard Library".

The article literally says "It's my time, and I'll waste it if I want to!" and uses "pystd" as the namespace.

franzb 4 days ago

What makes his library “standard”?

munificent 4 days ago

I think the author pretty clearly means "standard" in the sense of "providing functionality at the same level as the C++ standard library".

For example, if I were to say "I'm going to write my own Dune", you'd probably understand that to mean my own broadly-interpreted sci-fi epic, and not literally a clone of Dune with Paul Atreides, the Bene Gesserit, etc.

qznc 5 days ago

How do you know about a billion-dollar multinationals threatening suit?

bsoles 5 days ago

> I maintain an implementation of the C++ standard library for a living.

I have always wondered: does the standard library have a huge test suite? For that matter, how is the language implementation itself tested against regressions, etc. If anybody has some knowledge about this...

jb1991 5 days ago

I agree, and every time I see someone refer to the standard library as the STL, I know I’m interacting with someone who doesn’t actually know the language very well.

dataflow 5 days ago

> I agree, and every time I see someone refer to the standard library as the STL, I know I’m interacting with someone who doesn’t actually know the language very well.

I would put away the judgment. I and many others still call it the STL despite knowing the language and history of the term. Because that ship sailed and it's what many people call it nowadays. Because writing out "the standard library" every damn time gets really tiring really fast.

It works in the reverse direction too, btw. The people who constantly nitpick on this are usually the ones who are more focused on being pedantic than being helpful. So that's the signal you send when you do that. Ask me how I know.

badsectoracula 5 days ago

Pretty much every C++ developer i've ever interacted with the last 25 years -informally- refers to the standard library as 'STL'.

I do not think anyone with even a small amount of C++ experience will be confused when 'STL' is referenced in the context of C++.

Of course it might be that every C++ developer i've interacted with doesn't really know the language very well. But considering the popular axiom that says something along the lines of 'people who claim they know C++ do not really know C++ while people who know C++ do not claim they know C++' what you wrote might actually be true :-P.

pton_xd 5 days ago

Yeah but, it's one thing to informally refer to it as the STL; people will know what you're talking about. It's another to write an article about the standard library and say "The C++ standard library (also know as the STL)," which is a false statement and implies the author doesn't know what they're talking about. That's what the parent is referring to, I think. Personally no one I know has even informally referred to it as the STL since at least C++11, so it's a bit jarring to read.

tom_ 5 days ago

If it's a thing people call it (and they do) then surely there's no better qualification for that being something it's also known as.

jb1991 5 days ago

It’s not a thing that anyone I know who works professionally in the field calls it. Not for at least 10 years now. Some hobbyists do, though.

Maxatar 5 days ago

One of the main contributors to the C++ standard library refers to it that way. I can also confirm that many members of the C++ Committee refer to it that way as well.

https://old.reddit.com/r/cpp/comments/c90sxa/whats_the_diffe...

jb1991 5 days ago

That was half a decade ago. I’d be curious if they still feel that way.

aw1621107 5 days ago

From ~10 days ago [0]:

> I'm pretty good at language lawyering code patterns that the STL uses, but I only know a tiny slice of modules.

From a different comment around the same time [1]:

> Life would be easier if we could do a hard migration from classic includes to named modules, but the STL can't do that.

> <snip>

> For MSVC's STL, we have the headers (happy fun land), std.ixx (has to be built by the user, but otherwise is simple), and the separately compiled code that goes into msvcp140.dll/libcpmt.lib (scary town, complicated, always built classically in the VS Build Lab, knows nothing about modules).

[0]: https://old.reddit.com/r/cpp/comments/1jb8acg/what_is_curren...

[1]: https://old.reddit.com/r/cpp/comments/1jb8acg/what_is_curren...

tom_ 5 days ago

Well there you go. Just as you say, it is also known as the STL.

ryandrake 5 days ago

Well, a lot of people in general use words incorrectly when speaking informally, that doesn't make that usage correct. Irregardless, for all intensive purposes, I could care less how people say STL.

messe 5 days ago

> that doesn't make that usage correct

Eventually it does. That's how language evolves. Prescriptivism is pointless pedantry.

ryandrake 5 days ago

Yes, language evolves over long periods of time, but not all incorrect spelling and usage is language evolving in front of our eyes. Sometimes, it's just poor English knowledge.

EnergyAmy 5 days ago

I think you missed that the OP was demonstrating that statement false in the latter portion of their comment.

wholinator2 5 days ago

Also, pedantry warning, the phrase is "intents and purposes", not "intensive purposes". Also "could care less" implies you do care, "couldn't care less" implies you don't.

pton_xd 5 days ago

Well that's his point. But in the context of this discussion, if he's writing a post about English idioms and expressions and writes like that, no one is going to take his opinion seriously.

eska 4 days ago

* Well, a lot of people in general use words incorrectly *

immediately followed by “irregardless”, “intensive purposes”, and “I could care less” reads like a troll post

billforsternz 5 days ago

I see what you did there, well played sir.

cozzyd 5 days ago

Saint Louie

Longhanks 5 days ago

Yet, Microsoft's own implementation was open sourced in 2019 in the repo "microsoft/STL" and in the second line of the readme claims the C++ standard library be also known as STL and the readme continues to use the term STL to refer to the C++ standard library.

(https://github.com/microsoft/STL, https://github.com/microsoft/STL/commit/219514876ea86491de19..., https://github.com/microsoft/STL/blame/main/README.md#L3)

electroly 5 days ago

From https://learn.microsoft.com/en-us/cpp/standard-library/cpp-s... --

"Microsoft's implementation of the C++ Standard Library is often referred to as the STL or Standard Template Library. Although C++ Standard Library is the official name of the library as defined in ISO 14882, due to the popular use of "STL" and "Standard Template Library" in search engines, we occasionally use those names to make it easier to find our documentation. From a historical perspective, "STL" originally referred to the Standard Template Library written by Alexander Stepanov. Parts of that library were standardized in the C++ Standard Library, along with the ISO C runtime library, parts of the Boost library, and other functionality. Sometimes "STL" is also used to refer to the containers and algorithms parts of the C++ Standard Library adapted from Stepanov's STL. In this documentation, Standard Template Library (STL) refers to the C++ Standard Library as a whole."

zabzonk 5 days ago

> the readme continues to use the term STL to refer to the C++ standard library.

Would not be the first time Microsoft were wrong about a standard.

germandiago 5 days ago

STL is actually a subset of the full C++ standard library, which includes, for example, C headers.

The STL is the algorithms + data structures + utilities, which are templates.

Longhanks 5 days ago

From a dogmatic point of view, this might've been correct at some point in time. But, as the links from above clearly point out, most people use "STL" and "C++ standard library" interchangeably (including the very maintainers of one of the most populous C++ standard library implementations), without excluding certain parts of one or the other.

caspper69 5 days ago

Interesting that their implementation is Apache 2.0 licensed, yet includes exceptions for LLVM and for GPLv2 licensed code/projects wrt patents.

Does anyone know if the library's quality is on par with the GNU or Clang libraries? Google has their own too, if memory serves. Is there an implementation deemed "the best"?

Longhanks 5 days ago

The license was explicitly chosen to enable code sharing with LLVM's libc++ (https://devblogs.microsoft.com/cppblog/open-sourcing-msvcs-s...).

The MSVC STL's quality is good enough for thousands of pieces of Windows software (including Windows itself & Microsoft's software such as Office) to depend and rely on. It delivers excellent performance for a broad range of use cases. It is actively developed in the open, delivering cutting-edge (C++23 & C++26) features, accepting Pull Requests and wonderfully documented on GitHub. It can be consumed using MSVC and LLVM clang-cl (which the MSVC STL maintainers test with CI infrastructure). The maintainers are actively working on "hardening" features to enable more secure C++ (https://github.com/microsoft/STL/wiki/STL-Hardening).

Unless you specify what "best" or "a library's quality" means to you, MSVC STL is excellent and because of that, the default choice on & for Windows.

Google chooses to only support libc++ for Chrome/Chromium (https://chromium.googlesource.com/chromium/src/+/main/docs/t...). libc++ is not a Google-owned project.

caspper69 5 days ago

Thank you for the insightful post.

jb1991 5 days ago

I certainly don’t think Microsoft can be used as a barometer for what is considered accurate or standardized with C++.

pjmlp 5 days ago

I use C++ since 1993 and still refer to the standard library as STL, as do many WG21 members in many of their conference talks, do they don't know C++ very well?

It is a matter of habit and none of us are going to change, only because some folks think otherwise on the Internet.

whobre 5 days ago

Meh - many simply use STL for the STandard Library. Few people even remember Stepanov’s Standard Template Library.

werdnapk 5 days ago

So I haven't been a C++ programmer for almost 20 years now (I would have considered myself very experienced with it at the time) and STL was the Standard Template Library for me back then. Is the Standard Template Library no longer in (widespread) use? Would any modern C++ programmer use it anymore?

stonemetal12 5 days ago

The STL was standardized and made part of the standard library in 1998. So no it hasn't been a thing in more than 20 years.

It was around 2003 when I noticed people start to take issue with calling the standard library templates the STL. IDK why. Used yes, referred to as the STL not unless you like hostility from the language lawyers on stack overflow.

injidup 5 days ago

A modern c++ programmer uses Rust so no.

pjmlp 5 days ago

The SGI documentation for it was quite nice though.

serial_dev 5 days ago

I mean, I think you have unreasonable expectations for a 1K word blog post. Or maybe I have very low standards and no matter how disappointing a post is, I accept it... could be. However, if I read a blog post on "Rewrite React from Scratch", I'm expecting to see some reactivity and that's it.

As a reader, after I see I barely need to scroll to the end of the article (and the repo isn't very big either), I immediately understood that they aren't rewriting C++ standard library from scratch. Of course they can't give all the answers on how to maintain backwards compatibility with decades of legacy stuff with probably billions of devices and exotic use cases..