News for hackers. Stuff that matters.
Re:Some Smalltalk about Ruby Loops by stonecharioteer on Monday October 20, 2025 @11:01AM (#45644733)
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/

Re:Some Smalltalk about Ruby Loops by ktpsns on Thursday October 30, 2025 @08:11AM (#45759148)
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.

Re:Some Smalltalk about Ruby Loops by graemep on Thursday October 30, 2025 @08:29AM (#45759282)
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)]))
Re:Some Smalltalk about Ruby Loops by stonecharioteer on Thursday October 30, 2025 @11:15AM (#45760965)
I've done Python for 12 years and I'd reject that PR.
Re:Some Smalltalk about Ruby Loops by barisozmen on Thursday October 30, 2025 @08:35AM (#45759322)
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/
Re:Some Smalltalk about Ruby Loops by stonecharioteer on Thursday October 30, 2025 @11:15AM (#45760957)
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!

Re:Some Smalltalk about Ruby Loops by stonecharioteer on Monday November 03, 2025 @06:52AM (#45798098)