3 ms·
Some Smalltalk about Ruby Loops
- stonecharioteer 1y agoI 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/ https://tech.stonecharioteer.com/posts/2025/ruby-blocks/
- ktpsns 1y agoI 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.
- graemep 1y agoIts 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)]))
- stonecharioteer 1y agoI've done Python for 12 years and I'd reject that PR.
- barisozmen 1y agoHey 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/ https://tech.stonecharioteer.com/posts/2025/ruby/
- stonecharioteer 1y agoThank 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!
- stonecharioteer 1y agoHello, I wrote the next post: https://tech.stonecharioteer.com/posts/2025/ruby-symbols/ https://tech.stonecharioteer.com/posts/2025/ruby-symbols/