|
|
|
|
|
by zenspider
6497 days ago
|
|
assignment evaluation to RHS catches everyone once in a while. I'd have gone with the plain `squid` at the end. Maybe even with a `return` if I was feeling chatty. (It took me a long while to get over my anti-return-for-speed-reasons bias... I'm still working on it sometimes.) Besides, I'm not that much younger than you. :P I think it is mostly that you went the lispy route while I took the smalltalk route. ETA: actually... I'll go one step further... `returning` violates "Do the Simplest Thing That Could Possibly Work" flat out without giving you anything in return. |
|
We agree on the maxim while disagreeing with how to apply it. For me, "returning" is simpler because it seems to involve fewer moving parts: you don't have to remember to write 'squid' at the end and you get a local variable that is scoped only to the block where it is needed.
To you, it is a gross and needlessly complicated way to write begin; squid = ...; squid; end. I can see how you would feel that way without feeling that way myself.
I'm curious about the aversion to Symbol#to_proc. If you see [...].map(&:name) and think of it as an abbreviation for { |element| element.name }, there isn't much to like.
But coming from Smalltalk, does your brain ever click over and make you think of [...].map(&:name) as meaning "map the message :name over this array"?
I ask because when I think of languages like Smalltalk and Ruby, I go along with Alan kay and thenk of them as being message-oriented rather than object-oriented. Symbol#to_proc seems to fit that somehow in my brain. I dunno how to explain it any other way, it really feels less like an abbreviation to save some characters and more like getting closer to what I am trying to say...