Articles

(Mar 19) #rust #llvm Save to Pocket

In C++, forward progress guarantees are defined as "when only one thread that is not blocked in a standard library function executes an atomic function that is lock-free, that execution is guaranteed to complete". The LLVM currently handles the lack of a forward progress guarantee as undefined behavior, which is incorrect in the case of Rust. Mark Rousskov has written an article that introduces this issue, explains how it remains unsolved because of problems arising from attempted solutions, and discusses the possibility of a solution.

(Mar 24) #swift Save to Pocket

In Swift, "when a type supports a zip implementation, two (or more) of a its instances can be paired". This can be useful for pairing results together, like if you want one failure in a series of RESTful calls to result in total failure. In this article, Jasdev Singh does a deep dive into how you can implement your own version of zip (you choose how to the results are paired!) in Swift, for the Result and Combine types.

(Mar 30) #cpp Save to Pocket

Span is a new class template in C++20 that can refer to a contiguous sequence of objects. They're useful because they replicate built-in iterable container classes without any of the overhead. Unfortunately, it's not likely to come with a built-in comparison function. Fortunately, Barry Revzin has written a thorough article that shows us how to implement a deep comparison between spans and some other containers both in C++17 and C++20.

And that's it for today! Discuss this issue at our subreddit r/morningcupofcoding.

Did you like what you read? Let us know by clicking one of the links below.

Liked - Disliked

I hope you enjoyed reading the latest issue of Morning Cup of Coding. If you did, consider supporting us by becoming a patron (Patreon) for perks like ad-free issues, or via a one-time donation via PayPal.

Interested in sponsoring our newsletter? Click here to send us an email.

Cheers,

Pek