Preferences

I am a Ruby programmer that came to Ruby as a Python programmer that had do do work mainly in PHP and JavaScript (no jobs in Python where I lived at the time). I sort of liked JavaScript (I know it so well now that I’m ambivalent about JavaScript) and started to really despise PHP (most of the problems I hated back then are gone now but I can’t go back). When I searched for a job that wasn’t PHP or Java based I found a Ruby on Rails job and Ruby really did something for me (and with me). I really liked it and was a bit confounded because I’ve looked into it before and it didn’t do anything for me back then.

Since then I’ve returned to Python for some projects and I find that Python made me better at Ruby and Ruby made me better at Python. JavaScript, Ruby and Python are my main goto languages for scripting and web programming and I think Ruby is getting the short end of the three languages. It deserves better and I think more people, especially web developers and people that need a *NIX scripting language should give it a try.

What I don’t really understand is that we (Ruby programmers) still use indentation for block definition as a reason against Python. Especially since yaml, haml and sass are technologies we helped build and popularize and they are all indentation based. I still agree that Python is the less elegant and more importantly the less fun language.


> What I don’t really understand is that we (Ruby programmers) still use indentation for block definition as a reason against Python. Especially since yaml, haml and sass are technologies we helped build and popularize and they are all indentation based.

The article was written by an LLM[1], not a Ruby programmer.

[1](https://www.hackerneue.com/item?id=42102000)

Now I get your point. That would be a good explanation why the arguments are surface level and regurgitated. This is not really something I want to have to look out for.
nobody serious uses indentation as a bad point against Python. Ruby pretty much could work with indentation instead of "end" almost without drawbacks. Maybe irb would be slightly less convenient, and that's it. Whitespace IS significant in ruby too, it's just goes so much along with the programmer's intuition that it rarely bites anyone.
Indentation was seriously being used as a point against Python when I came to Ruby and we had lots of DSLs that where indentation based back then. I always felt that do be BS and I think it is meant seriously here too, in this article. I do agree that isn’t an argument I have heard used seriously in a long time tough.
The usual argument is that bracketed syntax rather than indentation-based syntax makes it possible/easier to have multi-line anonymous functions (such as with Ruby's block syntax), and especially to use them within more complex expressions.

Pythonistas generally consider that a misfeature.

You can have indentation based syntax and ; for multiple statements in one line, or something even more powerful. But it doesn't matter.

Main power of blocks is not being multiline or being closure-like, many languages have this. But blocks are not just anonymous functions or lambdas, they have ability to return from the outer method (or from the method to which it was passed with break), acting as a powerful tool for creating your own flow control structures if needed, or just replacing "for". Of the languages I know or heard of only smalltalk does the same.

You can live without those, you can live even without early return, but blocks are not a misfeature, it's a great and intuitive tool. And python's rudimentary lambdas make me cry a little.

This item has no comments currently.