Jonathan Boccara writes about C++, covering ranges, metaclasses, named arguments, code readability, and language changes.
Commenters recommend it as a solid C++ resource and link its posts on strong types and named arguments, which C++ lacks natively.
Seems to me that someone "stole" it from F#. F# probably also take this idea from some unknown (to me) language. Here a similar idea in C++ https://www.fluentcpp.com/2019/10/18/piping-to-and-from-a-stream/
This is generally a weakness of text based programming languages, that you cannot easily express graph flows like:
/ B1 \
A>-| | -> C
\ B2 /
|> operator only solves the problem for non-branched flows like A -> B -> C making them more readable by removing nested calls.
In theory you can create something similar using JS OOP by attaching e.g. map/use(func) methods to every prototype:
function use(func)
{ func(this); return this; }
function map(func)
{ return func(this); }
and then:
(1).map(n => n+1)
.use(console.log)
.map(n => "n = " + n)
.use(n => console.log("str = $n"));
Introducing a new operator instead of a library is a huge effort. I don't think this proposal will succeed, especially that current custom operator support in JS is nil.
Julia Evans' blog is one of my favorites! It was a big inspiration for starting my own blog (https://andythemoron.com). I also love High Scalability and Dan Luu's blog which have been mentioned in other comments.
I "follow" several which are mostly defunct, but in terms of blogs that still feature active updates:
Evan Klitze's blog: lots of topics around Linux, C++, etc. https://eklitzke.org/
Sutter's Mill: lots of "state of the world" for C++, but also context, history, etc. https://herbsutter.com/
IT Hare: C++, game programming http://ithare.com/
The Erlangelist: Erlang/Elixir http://theerlangelist.com/
null program: lots of miscellaneous topics http://nullprogram.com/
Fluent C++: the name speaks for itself http://www.fluentcpp.com/
Another Programmer's Blog: Linux, C, C++, C#, MSSQL https://www.stev.org/
So, I dug into this a bit more, and you're right!
https://www.fluentcpp.com/2017/06/13/the-real-difference-between-struct-class/
Maybe it was the era that I learned C++ (which was in the 98 days), but I was taught something closer to this convention, and didn't realize until just now there was such little difference by the book. Just bundling some data together? Use a struct. Doing more? Use a class.
I still think this distinction is useful overall, because there often is more of one in many languages, but I will be more precise when speaking about C++ specifically in the future. I would also still argue the same thing overall, that is, Rust does not have what C++ calls classes. Our structs are apparently even simpler than C++ structs.
> In C#, you create a class when it's an object, and a struct when it's a data structure, or am I missing something?
Yes and no. Due to the technical limitation that (unlike in C++[0]) structs in C# cannot derive from other structs, DTOs in C# are often implemented (or rather: generated) as classes to allow derivation from a base class that has certain behavioral hooks (say, for misc. custom serializers).
[0] See https://www.fluentcpp.com/2017/06/13/the-real-difference-between-struct-class/ (the real technical difference between struct and class in C++ is just that the default visibility modifier for a struct is public and the default visibility modifier for a class is private; both can use inheritance and have virtual methods)
When it comes to std::optional, the answer is no. In fact, std::optional<T&> is explicitly forbidden (see here: https://www.fluentcpp.com/2018/10/05/pros-cons-optional-references/)
It is used in some other places though. For instance, std::string implementations typically employ small-string optimization (SSO) which means that there might be a limit on string::size() since some of the bits inside that value are used for different purposes (example: https://akrzemi1.wordpress.com/2014/04/14/common-optimizations/). The "niche" in this case is the realization that strings are unlikely to be exabytes in size, so there is no reason to always store zeros in high bits of _size.
Having started using the Internet in the 90's, and thus still remembering Geocities-era websites, I loved that they did this as a webring (https://en.wikipedia.org/wiki/Webring): each blog post has a link to the next one, making a singly-linked circular list.
Starting with this one, we have:
- http://www.bfilipek.com/2018/04/deprecating-pointers.html
- http://www.modernescpp.com/index.php/no-new-new
- https://www.fluentcpp.com/2018/04/01/cpp-will-no-longer-have-pointers/
- https://blog.tartanllama.xyz/no-pointers/
- https://arne-mertz.de/2018/04/raw-pointers-are-gone/
And it circles back to this one.