Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Some Smalltalk about Ruby Loops (stonecharioteer.com)
18 points by stonecharioteer 5 months ago | hide | past | favorite | 7 comments


Hey OP, please continue this series! I'm in the same ship with you. I've been a Python developer for years, but recently start learning Ruby after I discovered its elegance. Your post here well resonates with me: https://tech.stonecharioteer.com/posts/2025/ruby/



Thank you! I will be writing more. I'm writing one about Symbols right now.

A repost of this thread hit the front page, I'm so happy!


I agree on the wording difference (method vs message), but the differences still seem to be minor. When it comes to explorability/reflection, Python also has callable(). Both languages are lazy & duck typed. And Pythons for loops emphasize the generator/iterator idioms. I personally prefer Ruby syntax for looping: In JS I prefer forEach() and yet nowadays ES6 defined for-of loops as idiomatic, isn't it?

Sometimes it is not syntax but functionality and stdlib which brings you to a language. For instance, I love the metaprogramming and dynamic dispatch of Julia but I strongly dislike the syntax.


I wanted to follow up from my post about ruby blocks[1] and I thought I should talk about loops and how they work.

[1] https://tech.stonecharioteer.com/posts/2025/ruby-blocks/


Its a nice demo of Ruby but I disagree with that is what it looks like in Python.

I would probably do something like

  print("\n".join([f"i={i}" for i in range(1, 10)]))


I've done Python for 12 years and I'd reject that PR.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: