Some Smalltalk about Ruby Loops

Ruby orders numbers around — Python fans groan, Smalltalk elders smirk

TLDR: A post claims Ruby’s loops are really “messages” sent to numbers, channeling Smalltalk’s philosophy. Comments erupted: critics slammed side-effects and called the “message passing” talk semantics, while others invoked Alan Kay and cheered Ruby’s intent-first style — a clash of code vibes vs practical reality.

A Ruby beginner wrote a love letter to the language’s “do it 10 times” style, arguing it’s not just a loop but a message to the number itself — a Smalltalk-flavored idea that had the comment section lighting up. The author even popped in with a link to a prior thread here. Cue the ruckus: one camp cheered the philosophy (“tell the object what you want”), while skeptics clapped back that calling it “message passing” is just fancy branding for the same old method call. The hottest take? A commenter torched the notion of adding side-effects via these loops as “absolutely horrible,” drawing a chorus of nods and eye-rolls in equal measure.

Others went academic, name-dropping Smalltalk and Alan Kay — with a direct quote that it’s “about messaging” — and arguing Ruby’s vibe is more intent than syntax. Meanwhile, pragmatists insisted Ruby and Python both look up methods and call them; the difference is mostly theater. Nostalgia snuck in too: old-school Smalltalk fans praised Ruby for bringing that playful, exploratory feel to the masses. The meme energy was strong: “It’s not a loop, it’s a vibe,” “electronic telepathy,” and a lot of winks at Ruby’s .send magic. Verdict: philosophy class meets code camp, with popcorn-worthy snark.

Key Points

  • Ruby iteration is commonly expressed via object methods like Integer#times with a block, rather than Python-style for loops.
  • Ruby’s model can be viewed as sending a message (via send) to an object, which determines how to act on the block.
  • Python for loops iterate over an iterable (e.g., range(10)), yielding values until the iterator is exhausted.
  • Ruby introspection (e.g., respond_to?) shows methods available on objects such as Integer, including times.
  • Smalltalk-inspired constructs (timesRepeat:, to:do:) parallel Ruby’s iteration (upto, each), illustrating protocol-over-syntax design.

Hottest takes

"No, it's an absolutely horrible way to 'add side-effects'" — Joker_vD
"I don't think Ruby's 'message passing' is fundamentally different from Python's 'method calls'" — pansa2
"Like Alan Kay himself said, it wasn't about objects, but about messaging" — top_sigrid
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.