Skip to content

Instantly share code, notes, and snippets.

View gruebite's full-sized avatar
🎯
Focusing

gruebite gruebite

🎯
Focusing
View GitHub Profile
@gruebite
gruebite / main.zig
Last active April 26, 2021 22:04
Zig dynamic dispatch with @fieldParentPtr
const print = @import("std").debug.print;
const Animal = struct {
const Self = @This();
speakFn: fn(*const Animal) void,
pub fn speak(self: *const Self) void {
self.speakFn(self);