M A E B e r u t to u f e h t W E N E D A M S A E D I D L O

M A E B e r u t to u f e h t W E N E D A M S A E D I D L O 2022 Edition

Sometimes in order to keep moving forward, not only must you take one step at a time, but you must be willing to look back occasionally and evaluate your past, no matter how painful it is. Looking back lets you know whether or not you are headed in the right direction. –G.K. Adams

Epigram 53 So many good ideas are never heard from again once they embark in a voyage on the semantic gulf –Alan J. Perlis, Epigrams on Programming (1982)

Meta

Brooklyn Zelenka @expede

Brooklyn Zelenka @expede • CTO at Fission (https://fission.codes) • Edge apps (“post-serverless”) • Goal: make back-ends and DevOps obsolete • PLT, VMs, distributed systems • Standards: DIF, UCAN, Ethereum, Multiformats, others • Founded VanFP, VanBEAM • Primary author of Witchcraft, Algae, Exceptional, etc

Meta 🔮

Meta 🔮

Meta 🔮 The BEAM does so much right 👏

Meta 🔮 How do we move forward as an ecosystem, cross language, cross paradigm?

Meta 🔮 How do we move forward as an ecosystem, cross language, cross paradigm?

Meta 🔮 Local Maxima

Meta 🔮 Local Maxima 😄

Meta 🔮 Local Maxima 😍 😄

Meta 🔮 Local Maxima 😍 😄 😭

Meta 🔮 Spoiler Alert 🚨

Meta 🔮 Spoiler Alert 🚨

  1. Breaking out of linear thinking / von Neumann 🌀

Meta 🔮 Spoiler Alert 🚨

  1. Breaking out of linear thinking / von Neumann 🌀 2. New types of modularity (for the BEAM) 🔌

Meta 🔮 Spoiler Alert 🚨

  1. Breaking out of linear thinking / von Neumann 🌀 2. New types of modularity (for the BEAM) 🔌 3. Composable languages 🗣

In the Beginning… 🌴🦖

In the Beginning… 🌴🦖

In the Beginning… 🌴🦖 Epigram 28 Around computers it is difficult to find the correct unit of time to measure progress. Some cathedrals took a century to complete. Can you imagine the grandeur and scope of a program that would take as long? –Alan J. Perlis, Epigrams on Programming (1982)

In the Beginning… 🌴🦖

In the Beginning… 🌴🦖

In the Beginning… 🌴🦖

In the Beginning… 🌴🦖

In the Beginning… 🌴🦖 29 Years

In the Beginning… 🌴🦖 29 Years

In the Beginning… 🌴🦖 29 Years

In the Beginning… 🌴🦖 29 Years

In the Beginning… 🌴🦖 29 Years 36 Years

In the Beginning… 🌴🦖 29 Years 36 Years

Paradigm Redshift 🌈

Paradigm Redshift 🌈

Paradigm Redshift 🌈 It’s really difficult to distinguish a new paradigm from a really bad idea […] The new shiny object is part of the old paradigm – Douglas Crockford, The Power of the Paradigm (2018)

Paradigm Redshift 🌈 Novelty Budget

Paradigm Redshift 🌈 Novelty Budget

Paradigm Redshift 🌈 Novelty Budget

Paradigm Redshift 🌈 Law of Conservation of Complexity

Paradigm Redshift 🌈 Law of Conservation of Complexity Every application has an inherent amount of complexity that cannot be removed or hidden, but only moved from place to place – Larry Tesler

Paradigm Redshift 🌈 The “What If” Tree

Paradigm Redshift 🌈 The “What If” Tree

Paradigm Redshift 🌈 The “What If” Tree

  1. Array-based 📈 2. Applicative Model 🤹 3. SML Module System 🔌 4. Natural & Biz Language 🕴

  1. Array-based 📈 2. Applicative Model 🤹 3. SML Module System 🔌 4. Natural & Biz Language 🕴 ✂ Paradigm Redshift 🌈 The “What If” Tree

  1. Applicative Model 🤹 3. SML Module System 🔌 4. Natural & Biz Language 🕴 ✂
  2. Array-based 📈 ✂ Paradigm Redshift 🌈 The “What If” Tree

Paradigm Redshift 🌈

Paradigm Redshift 🌈 Let’s start with something alien 🛸👽

Paradigm Redshift 🌈 Something Alien

Paradigm Redshift 🌈 Something Alien {↑1 ⍵∨.∧3 4=+/,̄1 0 1∘.⊖̄1 0 1∘.⌽⊂⍵}

Paradigm Redshift 🌈 Something Alien {↑1 ⍵∨.∧3 4=+/,̄1 0 1∘.⊖̄1 0 1∘.⌽⊂⍵}

Paradigm Redshift 🌈 Something Alien LIFE← {↑1 ⍵∨.∧3 4=+/,̄1 0 1∘.⊖̄1 0 1∘.⌽⊂⍵}

Paradigm Redshift 🌈 Something Alien LIFE← {↑1 ⍵∨.∧3 4=+/,̄1 0 1∘.⊖̄1 0 1∘.⌽⊂⍵} Attribution: wikipedia user LucasVB

Paradigm Redshift 🌈 What can we learn from APL? Cellular Automata & Actors as Organisms 🌸

Paradigm Redshift 🌈 What can we learn from APL? Cellular Automata & Actors as Organisms 🌸

Paradigm Redshift 🌈 What can we learn from APL? Cellular Automata & Actors as Organisms 🌸 • Each step is very simple

Paradigm Redshift 🌈 What can we learn from APL? Cellular Automata & Actors as Organisms 🌸 • Each step is very simple • Reasoning about dynamic organisms is hard!

Paradigm Redshift 🌈 What can we learn from APL? Cellular Automata & Actors as Organisms 🌸 • Each step is very simple • Reasoning about dynamic organisms is hard!

Paradigm Redshift 🌈 What can we learn from APL? Cellular Automata & Actors as Organisms 🌸 • Each step is very simple • Reasoning about dynamic organisms is hard! • Emergent behaviour 😱

Paradigm Redshift 🌈 What can we learn from APL? Cellular Automata & Actors as Organisms 🌸 • Each step is very simple • Reasoning about dynamic organisms is hard! • Emergent behaviour 😱 • VM in your brain to reason at a higher level

Paradigm Redshift 🌈 What can we learn from APL? Cellular Automata & Actors as Organisms 🌸 • Each step is very simple • Reasoning about dynamic organisms is hard! • Emergent behaviour 😱 • VM in your brain to reason at a higher level • We can abstract away some of this • Broadway • Arrows

Paradigm Redshift 🌈 What can we learn from APL? Universal Scaling Law http://www.perfdynamics.com/Manifesto/USLscalability.html

Paradigm Redshift 🌈 What can we learn from APL? Universal Scaling Law Amdahl’s Law http://www.perfdynamics.com/Manifesto/USLscalability.html

Paradigm Redshift 🌈 What can we learn from APL? Universal Scaling Law Amdahl’s Law USL http://www.perfdynamics.com/Manifesto/USLscalability.html

Paradigm Redshift 🌈 What can we learn from APL? Universal Scaling Law Amdahl’s Law Incoherence Penalty http://www.perfdynamics.com/Manifesto/USLscalability.html USL

Paradigm Redshift 🌈 What can we learn from APL? doall / Automatic Parallelism / Cyclic Multithreading 🔁

Paradigm Redshift 🌈 What can we learn from APL? doall / Automatic Parallelism / Cyclic Multithreading 🔁 1. Shared-nothing architecture 2. Good for embarrassingly parallel problems 3. Macro could do a LOT more with this at compile-time 4. Impurity and granular control mean that we don’t get this by default (with good reason)

Paradigm Redshift 🌈 OTP → TOP Table Oriented Programming

Paradigm Redshift 🌈 Table Oriented Programming Naive Tables

Paradigm Redshift 🌈 Table Oriented Programming Naive Tables Name Handle City Brooklyn expede Vancouver Quinn quinnwilton Mountain View Steven icidasset Ghent

Paradigm Redshift 🌈 Table Oriented Programming Naive Tables Name Handle City Brooklyn expede Vancouver Quinn quinnwilton Mountain View Steven icidasset Ghent

Paradigm Redshift 🌈 Table Oriented Programming Naive Tables Name Handle City Brooklyn expede Vancouver Quinn quinnwilton Mountain View Steven icidasset Ghent

Paradigm Redshift 🌈 Table Oriented Programming Perfectly Parallel Control Tables

Paradigm Redshift 🌈 Table Oriented Programming Functions Perfectly Parallel Control Tables Data

Paradigm Redshift 🌈 Table Oriented Programming Functions Perfectly Parallel Control Tables Data

Paradigm Redshift 🌈 Table Oriented Programming Functions Perfectly Parallel Control Tables Data

Paradigm Redshift 🌈 Table Oriented Programming Perfectly Parallel Control Tables Functions Zero dependencies by definition Data

Paradigm Redshift 🌈 Table Oriented Programming The Nth-Dimension 🚀

Paradigm Redshift 🌈 Table Oriented Programming

Composition & Modularity 🧱

Complexity & Modularity 🧱

Complexity & Modularity 🧱 –Alan J. Perlis, Epigrams on Programming (1982)

Complexity & Modularity 🧱 Epigram 6 Symmetry is a complexity-reducing concept; seek it everywhere –Alan J. Perlis, Epigrams on Programming (1982)

Complexity & Modularity 🧱 Epigram 6 Symmetry is a complexity-reducing concept; seek it everywhere Epigram 105 You can’t communicate complexity, only awareness of it –Alan J. Perlis, Epigrams on Programming (1982)

Complexity & Modularity 🧱 What do you mean by “composition”?

Complexity & Modularity 🧱 What do you mean by “composition”?

Complexity & Modularity 🧱 What do you mean by “composition”? HOF Application

Complexity & Modularity 🧱 What do you mean by “composition”? Modularity HOF Application

Complexity & Modularity 🧱 What do you mean by “composition”? Commutativity Modularity HOF Application

Complexity & Modularity 🧱 What do you mean by “composition”? Orthogonality Commutativity Modularity HOF Application

Complexity & Modularity 🧱 What do you mean by “composition”? Focus 🔬

Complexity & Modularity 🧱 What do you mean by “composition”? Focus 🔬 Composition in the data dimension

Complexity & Modularity 🧱 What do you mean by “composition”? Focus 🔬 Composition in the data dimension a b c d e

Complexity & Modularity 🧱 What do you mean by “composition”? Focus 🔬

Complexity & Modularity 🧱 What do you mean by “composition”? Focus 🔬 Composition in the function dimension

Complexity & Modularity 🧱 What do you mean by “composition”? Focus 🔬 Composition in the function dimension f g

Complexity & Modularity 🧱 What do you mean by “composition”? Focus 🔬 Composition in the function dimension f g Da ta flo w h

Complexity & Modularity 🧱 What do you mean by “composition”? Focus 🔬

Complexity & Modularity 🧱 What do you mean by “composition”? Focus 🔬 Composition in the capabilities (protocols and HOFs)

Complexity & Modularity 🧱 What do you mean by “composition”? Focus 🔬 Composition in the capabilities (protocols and HOFs) Data Function

Complexity & Modularity 🧱 What do you mean by “composition”? Execution Symmetry

Complexity & Modularity 🧱 What do you mean by “composition”? Execution Symmetry A program can be developed on a sequential platform, even if it is meant to run on a parallel platform, because the behaviour is not affected by whether we execute it using a sequential or parallel dynamics – Robert Harper, Practical Foundations for Programming Languages (2012)

Complexity & Modularity 🧱 What do you mean by “composition”? Execution Symmetry A program can be developed on a sequential platform, even if it is meant to run on a parallel platform, because the behaviour is not affected by whether we execute it using a sequential or parallel dynamics – Robert Harper, Practical Foundations for Programming Languages (2012) t

Complexity & Modularity 🧱 What do you mean by “composition”? Execution Symmetry A program can be developed on a sequential platform, even if it is meant to run on a parallel platform, because the behaviour is not affected by whether we execute it using a sequential or parallel dynamics – Robert Harper, Practical Foundations for Programming Languages (2012) t

Complexity & Modularity 🧱 What do you mean by “composition”? Execution Symmetry A program can be developed on a sequential platform, even if it is meant to run on a parallel platform, because the behaviour is not affected by whether we execute it using a sequential or parallel dynamics – Robert Harper, Practical Foundations for Programming Languages (2012) t

Complexity & Modularity 🧱 What do you mean by “composition”? Execution Symmetry A program can be developed on a sequential platform, even if it is meant to run on a parallel platform, because the behaviour is not affected by whether we execute it using a sequential or parallel dynamics – Robert Harper, Practical Foundations for Programming Languages (2012) t

Complexity & Modularity 🧱 What do you mean by “composition”? Execution Symmetry A program can be developed on a sequential platform, even if it is meant to run on a parallel platform, because the behaviour is not affected by whether we execute it using a sequential or parallel dynamics – Robert Harper, Practical Foundations for Programming Languages (2012) t

Complexity & Modularity 🧱 What do you mean by “composition”? Execution Symmetry A program can be developed on a sequential platform, even if it is meant to run on a parallel platform, because the behaviour is not affected by whether we execute it using a sequential or parallel dynamics – Robert Harper, Practical Foundations for Programming Languages (2012) t 👍 ! s e t u m m o c It

Complexity & Modularity 🧱 What do you mean by “composition”? Execution Symmetry A program can be developed on a sequential platform, even if it is meant to run on a parallel platform, because the behaviour is not affected by whether we execute it using a sequential or parallel dynamics – Robert Harper, Practical Foundations for Programming Languages (2012) t 👍 ! s e t u m m o c It

Complexity & Modularity 🧱 What do you mean by “composition”? Execution Symmetry A program can be developed on a sequential platform, even if it is meant to run on a parallel platform, because the behaviour is not affected by whether we execute it using a sequential or parallel dynamics – Robert Harper, Practical Foundations for Programming Languages (2012) t 👍 ! s e t u m m o c It

Complexity & Modularity 🧱 What do you mean by “composition”? Explicit Data Flow

Complexity & Modularity 🧱 What do you mean by “composition”? Explicit Data Flow

Complexity & Modularity 🧱 What do you mean by “composition”? Explicit Data Flow

Complexity & Modularity 🧱 What do you mean by “composition”? Explicit Data Flow

Complexity & Modularity 🧱 How Modular are Modules?

Complexity & Modularity 🧱 How Modular are Modules? (and libraries)

Complexity & Modularity 🧱 How Modular are Modules? (and libraries)

Complexity & Modularity 🧱 How Modular are Modules? Module-Level Modularity

Complexity & Modularity 🧱 How Modular are Modules? Module-Level Modularity “Hot-swappable dependencies”

Complexity & Modularity 🧱 How Modular are Modules? Module-Level Modularity “Hot-swappable dependencies”

Complexity & Modularity 🧱 How Modular are Modules? Module-Level Modularity “Hot-swappable dependencies”

Complexity & Modularity 🧱 How Modular are Modules? Module-Level Modularity “Hot-swappable dependencies”

Complexity & Modularity 🧱 How Modular are Modules? Hacking Extending the Module System

Complexity & Modularity 🧱 How Modular are Modules? Hacking Extending the Module System

Complexity & Modularity 🧱 How Modular are Modules? Hacking Extending the Module System

Complexity & Modularity 🧱 How Modular are Modules? Higher Order Modules 💖 Behaviours

Declarative Embedded DSLs 🍏🍊

Declarative Embedded DSLs 🍏🍊

Declarative Embedded DSLs 🍏🍊 I have regarded it as the highest goal of programming language design to enable good ideas to be elegantly expressed – Tony Hoare, Turing Aware Lecture, 1980

Declarative Embedded DSLs 🍏🍊 Isn’t Everything a DSL?

Declarative Embedded DSLs 🍏🍊 Isn’t Everything a DSL? Wide Narrow

Declarative Embedded DSLs 🍏🍊 Isn’t Everything a DSL? m g i d ra a P Wide t a P n r te n a L a u g e g D L S k n r o o i e t w c a e a c f i l r m p e a t r p n F I A Narrow

Declarative Embedded DSLs 🍏🍊 Isn’t Everything a DSL? Counterexample

Declarative Embedded DSLs 🍏🍊 Isn’t Everything a DSL? Counterexample This is just Elixir!

Declarative Embedded DSLs 🍏🍊 Isn’t Everything a DSL? Algebraic Data Type eDSL

Declarative Embedded DSLs 🍏🍊 Isn’t Everything a DSL? Algebraic Data Type eDSL

Declarative Embedded DSLs 🍏🍊 Isn’t Everything a DSL? Algebraic Data Type eDSL

Declarative Embedded DSLs 🍏🍊 Isn’t Everything a DSL? Algebraic Data Type eDSL

Declarative Embedded DSLs 🍏🍊 Business Language for Business Time 💼

Declarative Embedded DSLs 🍏🍊 Business Language 💼

Declarative Embedded DSLs 🍏🍊 Business Language 💼 What can we learn from COBOL? (Yes, really. COBOL.) Toggl, How to Kill at the Dragon in 9 Programming Languages

Declarative Embedded DSLs 🍏🍊 What Can We Learn from COBOL?

Declarative Embedded DSLs 🍏🍊 What Can We Learn from COBOL? When No One Wants to Go To Jail 👩⚖

Declarative Embedded DSLs 🍏🍊 What Can We Learn from COBOL? When No One Wants to Go To Jail 👩⚖ • Needs to be readable by lawyers • (Who can’t read code) • Formal methods & static analysis • Down to the compiler, of course • An unholy union of COBOL and Prolog

Declarative Embedded DSLs 🍏🍊 What Can We Learn from COBOL? When No One Wants to Go To Jail 👩⚖ • Needs to be readable by lawyers • (Who can’t read code) • Formal methods & static analysis • Down to the compiler, of course • An unholy union of COBOL and Prolog

Declarative Embedded DSLs 🍏🍊 Upside

Declarative Embedded DSLs 🍏🍊 Upside

  1. Fabulous for communicating with domain experts 2. We know how these DSLs work (e.g. they form an algebra) 3. They can be correct-by-construction 4. Check for various properties (compile- or run-time) 5. A language that exactly fits your needs (DDD)

Declarative Embedded DSLs 🍏🍊 But We Have a Problem

Declarative Embedded DSLs 🍏🍊 But We Have a Problem (Hint: it’s inflexibility)

Declarative Embedded DSLs 🍏🍊 🏖 Shallow Embedding 🦀

Declarative Embedded DSLs 🍏🍊 🏖 Shallow Embedding 🦀 i.e. The “Quick and Dirty” Way

Declarative Embedded DSLs 🍏🍊 Shallow Embedding

Declarative Embedded DSLs 🍏🍊 Shallow Embedding • Just use the built-in AST • What it can represent is limited • e.g. Ecto, Algae

Declarative Embedded DSLs 🍏🍊 Shallow Embedding • Just use the built-in AST • What it can represent is limited • e.g. Ecto, Algae

Declarative Embedded DSLs 🍏🍊 Shallow Embedding • Just use the built-in AST • What it can represent is limited • e.g. Ecto, Algae

Declarative Embedded DSLs 🍏🍊 Shallow Embedding • Just use the built-in AST • What it can represent is limited • e.g. Ecto, Algae

Declarative Embedded DSLs 🍏🍊 🌊 Deep Embedding 🦈

Declarative Embedded DSLs 🍏🍊 🌊 Deep Embedding 🦈 “Better AST”

Declarative Embedded DSLs 🍏🍊 Deep Embedding Three Steps

Declarative Embedded DSLs 🍏🍊 Deep Embedding Three Steps

  1. Build a game plan 2. Transform (optional) 3. Tear down

Declarative Embedded DSLs 🍏🍊 Deep Embedding “Build a Game Plan” Example

Declarative Embedded DSLs 🍏🍊 Deep Embedding “Build a Game Plan” Example

Declarative Embedded DSLs 🍏🍊 Deep Embedding Tradeoffs

Declarative Embedded DSLs 🍏🍊 Deep Embedding Tradeoffs •More work to write (write your own AST) •Way more powerful (full control) •Precisely the vocabulary that you need — exact surface area •Can check more things about the meaning of your code •Logic-as-data is MUCH simpler to debug than running functions •Time travelling debugging! •Unlike protocols, you’re not locked into one canonical implementation

Declarative Embedded DSLs 🍏🍊 Deep Embedding Combine Powerful, Modular, Reusable DSLs!

Declarative Embedded DSLs 🍏🍊 Deep Embedding Desugar

Declarative Embedded DSLs 🍏🍊 Deep Embedding “Huh, this kinda feels like GenServer” 😉

Declarative Embedded DSLs 🍏🍊 Deep Embedding “Huh, this kinda feels like GenServer” 😉

Declarative Embedded DSLs 🍏🍊 Deep Embedding “Huh, this kinda feels like GenServer” 😉

Declarative Embedded DSLs 🍏🍊 Deep Embedding “Huh, this kinda feels like GenServer” 😉

Declarative Embedded DSLs 🍏🍊 Deep Embedding With Their Powers Combined!

Declarative Embedded DSLs 🍏🍊 Deep Embedding One Last Line

Declarative Embedded DSLs 🍏🍊 Deep Embedding One Last Line

Declarative Embedded DSLs 🍏🍊 Deep Embedding More Flexible Than protocols

Declarative Embedded DSLs 🍏🍊 Deep Embedding More Flexible Than protocols

  1. Protocols require canonicity 2. Libraries of well-defined mini-languages, even without interpreter ff
  2. Di erent in tests and prod (trivial to mock)

Let’s Make New Mistakes! 💥✨

Let’s Make New Mistakes! 💥✨ 5 Problems for the Next 30 Years of BEAM

Let’s Make New Mistakes 5 Problems for the Next 30 Years of BEAM

Let’s Make New Mistakes 5 Problems for the Next 30 Years of BEAM

  1. Wasm — client & edge BEAM

Let’s Make New Mistakes 5 Problems for the Next 30 Years of BEAM

  1. Wasm — client & edge BEAM 2. Lower the barrier to entry (low code)

Let’s Make New Mistakes 5 Problems for the Next 30 Years of BEAM

  1. Wasm — client & edge BEAM 2. Lower the barrier to entry (low code) 3. Correctness tools (i.e. better static & dynamic analysis, formal methods)

Let’s Make New Mistakes 5 Problems for the Next 30 Years of BEAM

  1. Wasm — client & edge BEAM 2. Lower the barrier to entry (low code) 3. Correctness tools (i.e. better static & dynamic analysis, formal methods) 4. Automatic dynamic parallel evaluation

Let’s Make New Mistakes 5 Problems for the Next 30 Years of BEAM

  1. Wasm — client & edge BEAM 2. Lower the barrier to entry (low code) 3. Correctness tools (i.e. better static & dynamic analysis, formal methods) 4. Automatic dynamic parallel evaluation 5. Mobile agents (incl. dynamic FaaS)

Parting Thought 🧠

–Alan J. Perlis, Epigrams on Programming (1982)

Epigram 101 –Alan J. Perlis, Epigrams on Programming (1982)

Epigram 101 Dealing with failure is easy: –Alan J. Perlis, Epigrams on Programming (1982)

Epigram 101 Dealing with failure is easy: work hard to improve. –Alan J. Perlis, Epigrams on Programming (1982)

Epigram 101 Dealing with failure is easy: work hard to improve. Success is also easy to handle: –Alan J. Perlis, Epigrams on Programming (1982)

Epigram 101 Dealing with failure is easy: work hard to improve. Success is also easy to handle: you’ve solved the wrong problem. –Alan J. Perlis, Epigrams on Programming (1982)

Epigram 101 Dealing with failure is easy: work hard to improve. Success is also easy to handle: you’ve solved the wrong problem. Work hard to improve. –Alan J. Perlis, Epigrams on Programming (1982)

🎉 Thank You, India 🇮🇳 brooklyn@fission.codes https://fission.codes github.com/expede @expede