Not that I'm a big Ruby fan or anything, and I do agree with some of what you said, but... what does or doesn't look like a loop depends entirely upon what you're accustomed to. Pythons loop syntax isn't objectively better (I realize you said to you); however, don't think something else can't feel just as natural after a little experience with it.
There are advantages to the Ruby version as well, the Python version uses special syntax; a control structure one must memorize the semantics of. Semantics which are slightly different for different control structures in the language like knowing boolean expressions in if statements short circuit their evaluation, or the body of a loop is evaluated once for each iteration of the loop.
The Ruby version, copied from Smalltalk, is using a more general technique of building control structures in the library rather than as special syntax all built upon passing lambda/anonymous functions/blocks, whatever you like to call them, around to higher order functions like each. The benefit being you can see the delayed evaluation and build custom control structures in your own libraries without the need to memorize new semantics that aren't visible in the code as with procedural keyword control structures like if/when/do/while/switch, etc.
Admittedly, I think Ruby's version is a bit ugly, I'm a Smalltalker and find this much better...
{'list'} do: [:food | food capitalized print ]
And to me that looks totally like a loop. Once you have a concise notation for lambdas like [ ] or [:arg | ] you find much less need for special keywords and tend to want all control structures in the library rather than the language.
Lispers feel the same about their macros. To a Ruby programmer, each screams loop just as loudly as for to you, or do to a Smalltalker.
I know you did, and I acknowledged that, I was just trying to point out to you that you have the ability to change those emotional reactions; they aren't set in stone or based on logic.
Very true, and if this were a case of me disliking a fundamentally better language due to foreign syntax I would change that. However, after doing a lot of reading and experimenting with Ruby, I can't really find anything fundamentally better about it.
There isn't, frankly I find it a very ad hoc messy language myself. I just wanted to point out that lambdas and higher order functions are one the cool things about it, even though they do it wrong and have 3 different ways to create blocks.
Smalltalk does it right, blocks are real objects and have only one syntax for creating them and don't require being passed as the last arg to use the sweet syntax.
Comments
Not that I'm a big Ruby fan or anything, and I do agree with some of what you said, but... what does or doesn't look like a loop depends entirely upon what you're accustomed to. Pythons loop syntax isn't objectively better (I realize you said to you); however, don't think something else can't feel just as natural after a little experience with it.
There are advantages to the Ruby version as well, the Python version uses special syntax; a control structure one must memorize the semantics of. Semantics which are slightly different for different control structures in the language like knowing boolean expressions in if statements short circuit their evaluation, or the body of a loop is evaluated once for each iteration of the loop.
The Ruby version, copied from Smalltalk, is using a more general technique of building control structures in the library rather than as special syntax all built upon passing lambda/anonymous functions/blocks, whatever you like to call them, around to higher order functions like each. The benefit being you can see the delayed evaluation and build custom control structures in your own libraries without the need to memorize new semantics that aren't visible in the code as with procedural keyword control structures like if/when/do/while/switch, etc.
Admittedly, I think Ruby's version is a bit ugly, I'm a Smalltalker and find this much better...
And to me that looks totally like a loop. Once you have a concise notation for lambdas like [ ] or [:arg | ] you find much less need for special keywords and tend to want all control structures in the library rather than the language.Lispers feel the same about their macros. To a Ruby programmer, each screams loop just as loudly as for to you, or do to a Smalltalker.
From your explanation, I would then imagine that were I a long-time Smalltalk/Lisp user I would decry Python for its silly keywords.
As you noticed, I tried to make it obvious that some of my reasons were in no way objective.
I know you did, and I acknowledged that, I was just trying to point out to you that you have the ability to change those emotional reactions; they aren't set in stone or based on logic.
Very true, and if this were a case of me disliking a fundamentally better language due to foreign syntax I would change that. However, after doing a lot of reading and experimenting with Ruby, I can't really find anything fundamentally better about it.
There isn't, frankly I find it a very ad hoc messy language myself. I just wanted to point out that lambdas and higher order functions are one the cool things about it, even though they do it wrong and have 3 different ways to create blocks.
Smalltalk does it right, blocks are real objects and have only one syntax for creating them and don't require being passed as the last arg to use the sweet syntax.