Comment

Comment by geokon

> I don't recall ever writing my own protocol, record, or struct.

I'm honestly extremely surprised. Protocols seem sort of essential if you want two different "things" to exhibit the same behavior.

The whole set of immutable datastructures are fundamentally backed by them (well they use Java Interfaces but its fundamentally the same). Not entirely sure how youd implement them without Protocols

Theyre also sort of essential if you want plug-in backends for any part of your codebase.

Im curious what your go-to is currently? Do you just write multimethods and dispatch on the inferred input type?

parent geokon 2 months ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton