SamSuka
noboilerplate
noboilerplate

patreon


In Search of Code Purity

I was taught formal methods at university but these ultra-safe development techniques are expensive, require using unusual external verification languages, and most damning for web and application developers, they slow down iteration.

After graduating and getting a webdev job, I despaired that the safety and guarantees of the formal systems that I had been introduced to weren't available to me as a web developer.

I was going to have to act if I wanted to live in a different world.

---

I hope you like this one folks, I'm really pleased with it! There's an extra 3-minute deep-dive on formal methods  and the proptest crate for patrons only here.

Thank you so much for your support! <3

I have some alternate title options that I wonder if anyone has strong feelings about? Do let me know in the comments, and thank you again!

1. In Search of Code Purity
2. Rust's Secret Purity System
3. My Purity Journey from Haskell to Go to Rust
4. const fn: Pure Functions in Rust

In Search of Code Purity

Comments

Question about iterators being not allowed in const functions. (Context: I’m from TypeScript, PHP, Hack, some Python Web dev) What I understand of generator functions is that the function returns a thing (i.e. output) that the system knows the “contract” on how to get back to it and get the next value. This is definitely runtime realm. PHP7, TypeScript (ES2015 with more syntax), ECMAScript 2015, … They had to add some symbol in the syntax probably for the parser to do that difference in its bytecode (or equivalent) machine readable blobs. (Darn. I lost the question… after some time. Maybe that’s what follows) A pure function is supposed to be also a small unit of work. If one has to iterate, maybe it’s because something needs to be broken up some more. Say it’s to find a prime number you want to do. The checking about whether or not the input is prime can be pure. Assuming there’s no math “function” to find the next in sequence. But not the function blog articles would suggest next_prime to get another prime. Or type next_prime = (previous: number) => number We can’t know how many hoops will be needed. (Darn. That wasn’t the question. Sorry)

Renoir Boulanger

“Ship it”. In academia in software engineering related to Web. There isn’t much. Emilia Mendez being one I remember most from. Because a Web app is essentially shipping container and content in contrast to having to have software updates. As the reason to just shoot from the hip. > “binary holder” 🤌 I’m a Web dev. Fascinated by server, protocol, renderer, DOM, etc. But. Rust compiles into Web Assembly (!!) You’ve mentioned TypeScript. Maybe Deno and typing system as part of it more native? Maybe we can build binaries smaller than equivalent code written in v8 Node realm.

Renoir Boulanger

Everything is possible with a macro, you can write haskell inside Rust TODAY if you so chose ;-)

No Boilerplate

ha! well done! I will put the actual url in the public video, that's a good idea!

No Boilerplate

Yes, all videos eventually are published. This one drops on Friday!

No Boilerplate

Found them https://www.teepublic.com/stores/no-boilerplate ! (tshirts I mean ;))

Grzegorz Wierzowiecki

Great vid! I would be interested to know what it is like to work on a codebase that is full of pure functions. What is easier, what is harder? How much does it turn out can be pure? I am of course already sold on the idea that it would make me feel much happier and secure when changing code :)

Tim Urian

Most of this is over my head, but I'm hoping for some trickle down understanding from an occasional b-rain storm. Will this make it to your YouTube channel? I'd like to share it with a couple of fellow Rust fans.

AArexx AAron Ruscetta

This video has compelled me to order the rust programming language book.

Ahmed Haracic

Finally I feel I am not alone! I was searching ways to achieve purity in "more practical" (then haskell) programming languages... ended up decade ago deep diving into LLVM compiler, to eventually build "pure" keyword into languages... exploring Elixir/Erlang and others... proving properties and purity are beautiful.. thank you for putting this together. Both: once it will be shareable on yt I can point others without need of me trying to explain ... second new fresh look and perspective on Rust "Purish function" (not writting to not make a spoiler to others that wanna watch ;)). I still wonder if we could make a macro #[pure] macro or to put above those Purish functions (or clippy check) that would prevent other macros inside 🤔.

Grzegorz Wierzowiecki

Yeah! I might be paraphrasing that actually, "Javascript is Lisp in C's clothing" - I've heard that many times :-)

No Boilerplate

It's not a mistake/errata, but I'm remembering how I got into Computer Science by falling in love with Javascript. Learning about the history of Javascript, it's background connection to lisp and smalltalk, hiding in a c-like shell helped me spiral into an obsession with languages and why they all exist, and what makes one better than another for a given person or task. All that came flooding back with the "Rust is Haskell standing on Lisp hiding in a C-syntax to sneak into Production" line. Been fiddling with Rust in my free time, but I'll be doing more over this week.

Anastasia Middleton

Ooh, as a title suggestion? Not bad! I'll bear it in mind!

No Boilerplate

“Having my cake, and eating it too”?

Thomas Picard

PR here if you spy a mistake, thank you! https://github.com/0atman/noboilerplate/pull/57

No Boilerplate


More Creators