universeodon.com is part of the decentralized social network powered by Mastodon.
Be one with the #fediverse. Join millions of humans building, creating, and collaborating on Mastodon Social Network. Supports 1000 character posts.

Administered by:

Server stats:

3.4K
active users

Learn more

sigue

@screwtape

This will sound like sacrilege for but in I no longer use plain symbols as a poor-man's enum. Instead I do this:

define constant $rock = #"rock";
define constant $paper = #"paper";
define constant $scissors = #"scissors";

define constant <tool> = one-of($rock, $paper, $scissors);

and then type things as <tool> where appropriate. Et voilà, I can no longer misspell symbol names without getting a compiler warning. More importantly, neither can clients of my library.

EDIT: fix Dylan bugs, add last sentence.

Apr 01, 2025, 13:52 · · · Web · 1 · 6