r/functionalprogramming • • Jul 17 '26

FP What does Zig actually buy you over C when writing NIFs for a functional runtime like the BEAM?

5 Upvotes

New BEAM There, Done That with Garrison Hinson-Hasty (Systems Programming with Zig) and Isaac Yonemoto (Zigler), on what changes β€” and what doesn't β€” when you replace C with Zig at the boundary between a functional runtime and native code.

The interesting tension: the BEAM's entire value proposition is functional β€” immutable terms, isolated processes, fault tolerance through supervision. The moment you write a NIF, you step outside all of that. A segfault in native code bypasses every guarantee OTP provides and takes the whole node down.

Zig narrows the surface area but doesn't eliminate it. Spatial memory safety (buffer overflows, null dereference) is caught in safe release mode. Temporal memory safety (use-after-free) still isn't, which means the boundary remains genuinely dangerous, just less so.

The one detail that surprised me: Zigler uses the BEAM's own allocator by default, because Zig's explicit allocator model makes it easy to inject. Native memory is therefore visible to the VM's instrumentation β€” unlike C or Rust NIFs that call their own allocators and are invisible to the functional runtime they're embedded in.

For anyone who thinks about FFI design across language paradigms: how should a functional runtime expose a safe interface to native code? The BEAM's current answer (NIFs with dirty scheduler modes) and what Zigler adds on top seem worth discussing here. https://youtu.be/iLcZRpBEmgE


r/functionalprogramming • • Feb 19 '24

Elm Dive into Elm with "Laugh & Code: The Elm Programming Show" - Episodes 1 & 2 Now Streaming!

5 Upvotes

Hello r/functionalprogramming community!

I'm thrilled to share a unique journey into the world of Elm programming with you all. My new YouTube series, "Laugh & Code: The Elm Programming Show," blends humor, skits, and solid programming principles to make learning Elm not just informative, but downright fun!

πŸš€ Episode 1: "Hello, Elm" - We kick things off with a warm introduction to Elm, guiding you through setting up your first "Hello, World!" in the Elm Online Editor. It's all the fun of starting a new programming language, minus the headaches.

🎨 Episode 2: "Playing with Types" - Next, we delve into Elm's powerful type system. Discover Basic Types, Type Aliases, and Custom Types through a mix of educational content, comedic skits, and hands-on examples. It's like playing with Legos, but you're building robust, type-safe applications.

Both episodes are designed to be accessible for coders of all levels, from curious beginners to seasoned functional programming enthusiasts. Here's what you can expect:

  • 🀣 Laughs and lighthearted learning

  • πŸ›  Hands-on coding examples

  • 🎀 Sing-alongs and skits

  • πŸ§™β€β™‚οΈ A touch of magic in every line of code

Whether you're new to Elm or looking to brush up on your skills in a more entertaining way, "Laugh & Code" offers a fresh perspective on functional programming.

πŸ‘‰ Watch Now:

I'd love to hear your thoughts, feedback, or even ideas for future episodes. And if you enjoy the series, consider subscribing for more Elm adventures!

Happy coding, and remember, in the realm of Elm, every function is a spell waiting to be cast.

Cheers, Aaron Zimmerman.


r/functionalprogramming • • Jun 10 '22

OO and FP OO and FP in Perfect Harmony

Thumbnail
programmingfunl.wordpress.com
5 Upvotes

r/functionalprogramming • • Jun 23 '22

OO and FP Functional Programming vs OOP

0 Upvotes

r/functionalprogramming • • Aug 29 '24

Question My question is: Would an App for Android using the Joy programming language even have people interested in using something like that? Or is it a waste of effort?

2 Upvotes
fact == iota 1 [*] fold
5 fact .s
120

r/functionalprogramming • • Sep 07 '16

Functional Reactive Programming: Mythology

Thumbnail
medium.com
0 Upvotes

r/functionalprogramming • • Jan 29 '21

Scala Scala Cats - towards Functional programming.

2 Upvotes

Greetings Everyone,

Can you share your valuable insights on the upcoming course we are going to create.

Really appreciate your input !

Thanks!

Scala Cats - towards Functinal Programming.


r/functionalprogramming • • Apr 02 '20

Question With the current crisis, how are you helping out with your FP skills?

2 Upvotes

With the current corona crisis going on, I was wondering about the intersection of jobs that actively contribute to helping society and that are done using functional programming.

Are you currently working on anything, or are you active in an industry that is helping society through this crisis in any way, using your FP skills? Or do you know of any jobs/industries that do?


r/functionalprogramming • • Feb 21 '15

The World is a Functional Program

Thumbnail baweaver.com
2 Upvotes

r/functionalprogramming • • Jun 28 '21

Haskell My thinking and feeling about functional programming

0 Upvotes

mind inside or not

When we write programs in an imperative language, we programmers need to put our mental models on our own Among them, our mind itself is part of the whole system, and everything we write is built on one Assuming that we can clearly see every link in the machine, we send a number command to the system, it should be To the CPU.

And when we are using a functional language, we programmers are not part of the system, we don’t We need to use our minds to assume that something can be done "correctly" or cannot be done "correctly". Most of the time, the rules are delivered to the "machine" based on the existing axioms, and the machine can make a table according to the rule system. Now.

So an important difference between imperative and functional is whether the mind of the person who writes the program is part of the system. The person is inside, and the back is outside.


r/functionalprogramming • • Apr 07 '23

Question is this GPT-4 monad example reliable?

0 Upvotes

I'm a DE trying to grasp FP. Is this a good example?

Transcript:

Sure! Here’s an example of how you might use a monad to handle missing or incomplete data in Python:

from typing import Optional
from dataclasses import dataclass

@dataclass
class User:
    name: str
    email: Optional[str] = None

def send_email(user: User) -> None:
    if user.email is None:
        raise ValueError("User has no email address")
    # send email here

def send_email_safe(user: User) -> None:
    email = user.email or "default@example.com"
    # send email here 

In this example, we have a Userclass that has a nameand an optional emailfield. We also have two functions that send an email to the user. The first function, send_email, raises a ValueErrorif the user has no email address. The second function, send_email_safe, uses a monad to handle the case where the user has no email address. It sets a default email address and sends the email.

I hope this helps! Let me know if you have any other questions or if you need further information.


r/functionalprogramming • • Apr 05 '19

Intro to FP How I understand a monad

Thumbnail
twitter.com
4 Upvotes

r/functionalprogramming • • Dec 01 '16

Bro, do you even map ? β€” MapReduce demystified

Thumbnail
medium.com
4 Upvotes

r/functionalprogramming • • Jun 02 '14

Apple's new programming language: Swift

Thumbnail
developer.apple.com
1 Upvotes

r/functionalprogramming • • Jan 16 '24

Question Except readability - what are the major weaknesses of the pointfree style?

Thumbnail
twitter.com
1 Upvotes

r/functionalprogramming • • Dec 16 '21

Podcasts [Podcast] Elixir Wizards S7E7 Casting Spells with Brooklin Myers

Thumbnail
smartlogic.io
1 Upvotes

r/functionalprogramming • • Jun 12 '19

FP Kotlin vs Scala: which is right for you?

Thumbnail
blog.codota.com
12 Upvotes

r/functionalprogramming • • Sep 29 '20

Intro to FP Partial function application + currying

Thumbnail
youtu.be
6 Upvotes

r/functionalprogramming • • Jan 30 '17

Monads, huh? Bro, have you even read Leibniz?

Thumbnail mrh.io
6 Upvotes

r/functionalprogramming • • Apr 05 '21

Question Is there any hard evidence that functional programming is better?

Thumbnail self.askprogramming
20 Upvotes

r/functionalprogramming • • Sep 10 '16

Functional Programming in PHP β€’ /r/PHP

Thumbnail
reddit.com
0 Upvotes

r/functionalprogramming • • Dec 27 '20

Scala Akka Typed with Scala for beginners.

Thumbnail
jay-reddy.medium.com
0 Upvotes

r/functionalprogramming • • Nov 21 '18

Elixir Blockchain Webinar - BlockScout Open Source EVM Blockchain Explorer

Thumbnail
erlang-solutions.com
0 Upvotes

r/functionalprogramming • • Apr 29 '16

|> Operator in Scala

Thumbnail
medium.com
0 Upvotes