From: Gregory Brown Date: 2007-02-18T04:34:09+09:00 Subject: Re: Oppinions on RCR for dup on immutable classes On 2/17/07, Stefan Rusterholz wrote: > unknown wrote: > > the one that springs to mind is > > > > module Mixin > > def average > > total.to_f / n.to_f > > end > > def total > > raise NotImplementedError > > end > > def n > > raise NotImplementedError > > end > > end > > > > this give a much nicer error than NameError or something about nil not > > responding to 'to_f'. > > module Mixin > def average > total().quo(n()) > end > end > > a) uses Rational if possible ;-p (ok, besides the point) > b) no superfluous code > c) no additional exception > > I'm sorry, I still fail to see the point in defining a method that says > the method can't be executed (put a menu that isn't actually served on > the menucard - put it on the menucard when it is served) the difference is in the rescue. rescue NoMethodError is not the same thing as rescue NotImplementedError