From: Sean O'Dell Date: 2003-11-20T06:35:41+09:00 Subject: Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types) On Wednesday 19 November 2003 01:33 pm, Gavin Sinclair wrote: > On Thursday, November 20, 2003, 6:37:50 AM, Sean wrote: > > I'm only talking about checking that a certain interface is present. > > Just for the purpose of providing an informative error message when an > > object which cannot fulfill the needs of a method is passed. Right now, > > it just explodes with an ugly message about something that happened deep > > in the called method. Something more informative would go a LONG way. > > Nobody likes undescriptive error messages. You're asking Ruby to do > something about them, at a cost. I prefer to believe that the cost > should be on the library developer, who wishes to make life easier for > his clients. > > class LibraryClass > def library_method > # code ... > rescue SpecificError > # handle it > rescue => err > raise LibraryError, "library_method failed: #{err.message}" > end > end > > Granted, it doesn't often happen in real life, but it is better if the > library author is putting some thought into the user experience, > rather than feeling like he's jumping through hoops to keep an > interface-checker happy. A frustrated developer probably won't > produce much code; in that case, at least we'd have less cryptic error > messages, I suppose :) > > I'm not completely unsympathetic to what you're saying. In fact, I'd > like to read a detailed RCR. Funny you should mention that. =) Sean O'Dell