On Mon, Feb 16, 2009 at 3:25 AM, David A. Black [email protected]
wrote:
Some of the choices involve coupling things that I wouldn’t
necessarily put together, like the standard library and its use of
blocks (I’m not sure what you mean by the latter; things like
File.open {} ?)
Sorry about that. That one was a particularly bad case of trying to jam
together poll options so there weren’t so many to pick from.
But yes, you’re correct: in regard to usage of blocks by the standard
library I’m talking about things like File.open {}, or for that matter
String#gsub(x) {} or Enumerable#zip {}
I feel the Ruby standard library does a great job of making use of
blocks
and feel that’s one of the reasons blocks are so popular in general.
or open classes and monkeypatching (I don’t know which
of the various meanings of the latter you mean; I think they’re all
subsets of the former)
Pretty much, that was meant to cover all cases of altering the
definitions
of existing classes/modules at runtime by a facility which may lack
formal
knowledge of what the original definition actually was.
or optional parens and English-like readability
(I’m ambivalent about both, but for different reasons, and it depends
a bit which optional parens you mean).
This is another case of overlap… the “English-like readability” bit
typically plays into DSLs which use English words and generally try to
make
your code read more like a natural language (e.g. RSpec)
I certainly understand that people can like optional parens for other
reasons but DSLs are one particularly compelling use case for them, I
believe.
A couple of other things that might go on such a list:
String interpolation
This was covered by the poll, I believe, although described as:
Embedding code in strings with “#{mycode}”
I hadn’t heard the phrase “string interpolation” before but that’s what
it
covers, correct? If so, glad to know the proper term. That’s a
particularly nasty one to implement but one I’d like to try my hand at
soon
Zero being true
Yes, definitely a noticeable omission. I love Ruby’s boolean semantics
although they seem to confuse newbies to the language.
Single inheritance
Given how pervasive single inheritance is (and the fact I already
implement
it) I wasn’t particularly concerned about this, so much as using mixins
in
lieu of multiple inheritance. I thought about putting it on the poll,
but
decided to just list mixins instead.