Thoughtstream | Seminars

Transparadigm Programming in Raku
Transparadigm Programming in Raku

Each of the standard programming paradigms (imperative, functional, OO, declarative, concurrent) provides a collection of problem-solving tools that is optimized for particular kinds of tasks...and for particular ways of thinking about problem-solving.

But no single paradigm provides tools that are optimal for all kinds of tasks...or for all ways of thinking about problems.

Normally this means you have to adapt your software solutions to the limitations of your programming language’s unique world-view: if all you have is a hammer, every problem looks like a nail; if all you have is C, every problem looks like bit manipulation; if all you have is Haskell, every problem looks like the multiple dispatch of implicitly typed functions; if all you have is Java, every problem looks like yet another class library.

Raku is a programming language that seeks to create a single unified toolbox, integrating the major features of all five major paradigms to create a development platform that lets you select and combine the optimal linguistic tools for each job, no matter which universe they come from.

More importantly, Raku allows you to compose those tools together in natural ways within a single code block or subroutine. For example, you could implement a class method using functional programming. Or combine distributed and SIMD tests to control a single procedural while loop that’s embedded in an otherwise pure function. Or inherit a set of imperative actions that are nested inside the OO rules of a declarative grammar.

This means that a single Raku solution can easily combine C-like bit-manipulation (where that makes sense), with Haskell-ish multiple dispatch (when it’s convenient), with Java-y class hierarchies (if they also happen to be the right tool). Except that Raku has better bit-manipulation than C, much better multiple dispatch than Haskell, and a vastly better OO model than Java.

This talk will explore the idea of transparadigm programming in Raku using a series of simple (but real-world) examples, such as: LZW data compression, SHA-256 digests, AWS Glacier hash-trees, concurrent data validation, and parsing LaTeX documents.