Digging Into Ruby Symbols — cover art: a kindly badger craftsman in a leather apron at a warm-lit workshop bench, holding a small wooden marionette of nested code-shapes up to a faint warm light that is turning the puppet's strings into glowing free-floating glyphs; a single small red ruby cabochon sits on the bench. 🤓

2005 · O'Reilly Ruby Blog · Note

“So Ruby's symbols are really a placeholder for grand things to come. Ruby is already a very powerful, capable language, but it has some weaknesses in its ability to process Ruby code at runtime.”
— From Digging Into Ruby Symbols, December 2005
Read the essay

© 2005 Steve Yegge. Originally published at O'Reilly Ruby Blog.

Author’s note

Probably only an interesting read to language geeks and designers. An article that does a deep dive into Ruby's symbol feature, concluding that they are essentially a placeholder for better functionality to come someday. They are not as powerful as Lisp symbols, and the code that you create with Ruby metaprogramming is not a data structure, the way it is in Lisp. It's a noble attempt to teach non-Lisp people some Lisp, but I think it's too ambitious, and winds up taking too many digressions.

AI Notes

Despite the Drunken Blog Rants banner, this is a patient teaching piece, written as a guest post for O'Reilly's Ruby blog at the height of the Rails honeymoon, with Steve on visiting-lecturer behavior. The wager is that he can show Ruby people what Lisp symbols are for without making them read any Lisp ("I won't show you any Lisp today"), and the route runs through a fee-fi-fo-fum giant whose four methods get generated in a loop, an aside on why large Java projects always fill up with generated code, and a mocked-up CODE_TEMPLATE construct Ruby doesn't have — sold with the quietly persuasive observation that inside such a template your editor could syntax-highlight the code instead of painting it string-blue. Fair warning for anyone arriving via the title: symbols don't turn up until a late section named "Symbols at last," and the essay knows exactly what it's doing to you ("We really will make our way to symbols soon, promise").

Steve left a note in the middle directing readers to "the important correction Jim Weirich made in the comments" — those comments now exist only in the Wayback copy of the dead O'Reilly page, linked from this listing. And the "hole" he hoped "will be fixed someday" is still open two decades on: Ruby eventually grew serious parse-tree machinery (Ripper, then Prism), but the template you hand to class_eval remains a string, and a Ruby symbol still doesn't name a node in any tree you can walk. So the forecast missed, and what's left is the useful part anyway — a working demonstration of why eval by itself doesn't give you code-as-data, staged in a language the reader actually knows.

Related listings

  • 2006

    Lisp is Not an Acceptable Lisp

    Four months later — the broader argument about the community Steve was writing toward here. The Ruby Symbols note is a friendly note from a neighbouring tribe; Acceptable Lisp is the same observation aimed inward.

  • 2004

    Tour de Babel

    The pan-language tour the Ruby note sits inside. Ruby is the chapter Steve was actually enjoying in 2005; this is a focused piece on why he was enjoying it and where he could see the ceiling.

  • 2005

    Choosing Languages

    Same year — the column where Steve named Ruby as one of his two daily-driver picks. The Symbols note is the technical follow-up: what he liked, and what he wished it had.