4 ms·
"Blocks are actually a great example: what matz did was realize that often, you're only passing one anonymous function to another, and so he added special synta
by kab 16y ago
"Blocks are actually a great example: what matz did was realize that often, you're only passing one anonymous function to another, and so he added special syntax to make it nicer."
This argument, that you almost never need to pass in more than one block to a method, is true, only because Ruby doesn't as elegantly support the alternative. If it did, then you'd probably have plenty of multiblock methods like do:separatedBy: as you do in Smalltalk.
"With that said, you may disagree, but you can see where I'm getting at. Just because something did it _first_ doesn't mean they did it best."
So Smalltalk's blocks, which are versatile enough to be the basis for the language's control structures, are inferior to the block, proc, lambda trifecta of Ruby? Are you seriously telling me that you wouldn't prefer Ruby just have procs (real objects) with the block syntactic sugar and maybe also lamdbas, for their different return behavior?
"Smalltalk is a fine language, but I can't get into the whole image thing."
I used to feel the same way, but that was because I didn't understand the image. To me it was some digital blob with code and program state in it; I was always scared of breaking it or losing code. Then I learned how to actually use it, thanks to Squeak/Pharo by Example. Now I wouldn't have it any other way.
"While we're on this whole "educate others about language features" kick, Rubyists almost never use curly braces. One-line blocks are the only time. ;)"
Ruby is a curly brace language even if Rubyists opt not to use them; syntactically it belongs to the C family of languages, which are the "curly brace" languages.
- steveklabnik 16y agoWe're just going to have to agree to disagree over preferences here. Enjoy Smalltalk, it's great.