From: Gregory Brown Date: 2006-01-09T05:04:28+09:00 Subject: Re: Ideas on "Why Living Dangerous can be A Good Thing" in Ruby? On 1/8/06, James Edward Gray II wrote: > On Jan 8, 2006, at 9:00 AM, gwtmp01@mac.com wrote: > > > One of the things I really liked about Bertrand Meyer's _Object > > Oriented > > Software Engineering_ was his 'programming by contract' point of view. > > I've found that concept to be useful in almost any program I've > > written > > after reading that book regardless of the language I've used. > > > > One of the most useful ideas is the notion that if client code > > refuses to adhere to the pre-conditions then all bets are off and the > > library code has no responsibility to ensure correct behavior. > > This is an excellent point, in my opinion. If I write code like: > > not_my_object.instance_eval { @secret_value += 1 } > > I know I'm crossing the line. When it eventually breaks, I'll know > who's fault it is. For now though, I'm telling Ruby, "Just trust me; > I know what I'm doing here." The great part is that she believes me > and does it. ;) This is definitely a point worth making, that *most* people know that meta-programming is dangerous stuff, so their either extremely careful or their pretty open about letting you know that their efforts may well have unsavory effects. The key point to be made, I believe, is that ruby puts all the power... and the responsibility, in the programmers hands. Which in my opinion, is where it should be anyway.