Hi --

On Mon, 23 Feb 2004, Gavin Kistner wrote:

> Following the 'instance variable capitalization' thread, I'm convinced 
> that I should be trying to learn the Ruby idioms. Now I just need to 
> learn what they are.

You can get at least a good rough idea from the source.  From
/usr/local/lib/ruby/1.8:

$ ruby -ne 'print if /\b[a-z]+[A-Z]/.match($_)' `find -name "*.rb"` | wc -l
    862
$ ruby -ne 'print if /\b[a-z]+_[a-z]/.match($_)' `find -name "*.rb"`  | wc -l
  19943

[...]

> So, to the Question: is the above just a Bad Idea? Is camelCase *ever* 
> considered appropriate in Ruby?

I'll tell you why I dislike it.  There's the ugliness and the way I
hear it in my head (<soft>LOUD!), but obviously that's all a matter of
taste and not worth going into.  Beyond that, I dislike it because it
implies that Ruby doesn't already have stylistic conventions and
traditions, let alone perfectly good ones.  I don't know... I guess
it's related to my general feeling that Ruby comes in for much more
than its share of being treated like a preliminary draft of a language
rather than like a language with a culture, stylistic and otherwise.

(Reality check: I really do know that there's no direct correlation
between using camelCase and viewing or "treating" Ruby in any
particular way.  But it still triggers that "Why isn't Ruby 'allowed'
to just be itself?'" reaction in me, a bit.)

I'd find it easier to reconcile myself to camelCase if I felt that
this area was also in flux in other languages.  But I don't think it
is; I don't think many people write under_score variables in Java, for
instance, nor that the choice is looked at as an even one.  


David

-- 
David A. Black
dblack / wobblini.net