From: Gavin Sinclair Date: 2003-02-22T23:31:23+09:00 Subject: Re: Style question: using 'block_given?' On Saturday, February 22, 2003, 11:04:56 PM, Brian wrote: > Anyway, taking the original example which was something like: > class Tree > @data = nil > @kids = nil > def initialize(data) > @data = data > @kids = [] > end > end > then I don't think it's immediately obvious at a glance that: > 1. the first uses of '@data' and '@kids' are something completely different > to the second uses > 2. the things that you've created by the first assignments to '@data' and > '@kids' are actually fairly well hidden; the only way you can get at > them is via subclassing Class, or through class methods It's perfectly obvious at a glance to me. True, I've faced difficulty with such concepts in the past (at one point, I didn't understand the class << self business), but working through those difficulties is necessary to become proficient in Ruby. Not that I'm suggesting that difficult code be written for the sake of it. Only that there's no point shying away from complex-seeming constructs which, thankfully, are part of the consistency of the language. Gavin