3. Return

I’ve entitled this post return because for me it signals a return to normalcy.  My past couple of entries have been a true roller coaster for my emotions, and it’s time to get back to what YOU are here for: A blog about CODE.  This post will be about returning in three ways, you already know the first. I’ll explain the second in the next paragraph.

Thank you for joining me. Here. In the second paragraph. A truly seamless transition. I thought it would be best to discuss my second reason within the second paragraph because the numbers are the same. When you’re coding it’s often REALLY important to check whether your numbers are the same.  My second reason for writing about returning is that a return can often be called a retreat. If we’re lucky, the retreat is strategic, but history tells us that too many retreats are inflicted upon us by outside forces. Perhaps what we call strategy is merely a salve for our sanity, sheltering us from the frigid winds of fate. I wouldn’t be able to tell you.  If you’re looking for those kinds of answers, you’ve come to the wrong place, because this is a blog about code and the lifestyle of coding. This entry is a retreat. We’re falling back upon what it is we know with certainty. Instead of casting about for elusive answers, let’s talk about and appreciate for a while the answers handed to us by a mechanism so simple & elegant we often forget it: The returning of a value from a function.

It turns out that there’s continuity here. A through-line. Maybe even a lifeboat. Since my last post, I think we’ve all felt a little adrift. I’m finding that a life led without promises can be a turbulent one indeed. It is, however, the price we pay for our ideals, and if there’s one thing we can take true solace in, it is that the C++ standard library serves as the strongest of masts. For it supports our lofty ideals, and guides us through our stormy emotions.  I want to shine a beacon tonight on std::async, which has served as a port in my storm as I pivot from promises. In C++17, it’s become quite useful, given that it’s now defined with std::invoke_result_t rather than std::result_of_t.  std::result_of lets arrays degrade to pointers, and prohibits function types, yet allows references to them. Too weird! std::invoke_result fixes this, and looks a little prettier to boot.

std::async returns a future. I know you’re wondering what the future will hold. Buddy, so am I.  For now, I’m holding onto the future tightly.  I’ll tell you something though. The future of this blog is bright. You can hold me to that.

And I will return.

Zak O.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s