---
title: "Mason Protter (@Mason265) | Hashnode"
description: "Mason Protter (@Mason265) writes on Hashnode. Read their latest articles and follow their work."
url: "https://hashnode.com/@Mason265"
---

@Mason265

# Mason Protter

@Mason265 · Joined June 2023

## Comments

[I played around with this a few years ago in github.com/MasonProtter/PatternDispatch.jl julia> module PatternFruitFactory using PatternDispatch abstract type Fruit end struct Apple <: Fruit end struct Orange <: Fruit end @pattern fruit("apple") = Apple() @pattern fruit("orange") = Orange() @pattern fruit(s) = error("unknown fruit $s") end julia> @btime PatternFruitFactory.fruit("orange") 3.449 ns (0 allocations: 0 bytes) Main.PatternFruitFactory.Orange() These are extensible at a later time: julia> @btime PatternFruitFactory.fruit("banana") 7.537 ns (0 allocations: 0 bytes) Main.PatternFruitFactory.Banana() PatternDispatch.jl does some stuff that's unfriendly to precompilation though so it doesn't fit very well into packages. Very much just a proof of concept.](https://hashnode.com/posts/fruity-composable-design-patterns-in-julia/64958d80d5dec1509f8f963c/comment/6499c01a5244606d9b5ff904)

Comment · Article · Jun 26, 2023 · [Fruity Composable Design Patterns in Julia](https://hashnode.com/posts/fruity-composable-design-patterns-in-julia/64958d80d5dec1509f8f963c)
