Skip to main content

Posts

Showing posts from December, 2017

Ground Up Functional API Design in C++

There are plenty of reasons why functional APIs look and feel different than more common object-oriented APIs. A tell-tale sign of a functional APIs is existence of a core abstraction and a set of methods with algebraic properties. The abstraction part is of course about being able to talk about just the necessary details and nothing more. The algebraic part is about being able to take one or more instances of the same abstraction and being able to create a new one following some laws . I.e., Lawfully composing smaller parts into a bigger thing that is an instance of the same abstraction the original instances were. Composition by itself is nothing new to OO programmers. Composite, Decorator design patterns are all about putting together smaller pieces into something bigger. However, they miss out on the lawful part. Functional paradigm gives you extra guard rails so that you can bake in some well-understood mathematical properties into the abstraction. I think most people w

The video of New Tools for a More Functional C++

My previous talk on New Tools for a More Functional C++ ran into some audio issue during the meetup . I did not upload the video back then because it had no audio what-so-ever. I finally got around to record the audio track for the talk and I mixed it with the video. So here is the final video. Have fun with FP in C++! If you don't have 35 minutes, checkout the partial video transcripts below. Functional Programming Tools in C++ from Sumant Tambe on Vimeo . Video Transcripts 00:16 We’re going to talk about functional [programming] tools in C++ and what new capabilities exist in modern C++.  2:00 I'm reviewing  Functional Programming in C++ book by Manning---a good book for C++ programmers to acquire beginner to intermediate level knowledge of FP in C++. 2:30 Sum types and (pseudo) pattern matching in C++ 5:00 Modeling a game of Tennis using std::variant 7:30 std::visit spews blood when you miss a case in the visitor. See an exampl