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

Written for the O'Reilly Ruby Blog at the end of 2005, into a community quarrel about what Ruby symbols are for. The settled community answer ("use a symbol whenever you mean a name") was a clean rule that didn't explain why a name needed to be its own first-class type with its own syntax. Steve sides with the answer and keeps going: Ruby's symbols are the visible front of a Lisp feature Ruby doesn't quite have yet — code as data. The Pinocchio metaphor carries the middle. In Ruby (and Python, Perl, JavaScript) the template you hand to eval is a string, a puppet on strings; class_eval is the Good Fairy who takes it away into Pleasure Island, and what comes back is a real method, but the debugger can't step into the strings and the original template is gone. In Lisp the template is already a parse tree — a structure you can walk, modify, and hand to a syntax-aware evaluator. Symbols are the names in that tree. Ruby has the names without the tree, which is why the whole feature feels slightly hollow.

One of the few cross-publication pieces from the Drunken era — O'Reilly first, re-published on the Drunken site days later.

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.