From: Gary Wright Date: 2007-03-13T02:03:07+09:00 Subject: Re: string to int: ruby documentation? On Mar 11, 2007, at 11:20 PM, 7stud 7stud wrote: > The docs wrote: >>> Integer( arg ) -> anInteger >>> ....If arg is a String > > Gary Wright wrote: >> being raised. If you provide arguments that *don't* meet the >> pre-conditions of a method, well then you may or may not get an >> exception >> but it is really your problem in either case because you violated the >> pre-condition and all bets are off. > > I gave Integer() a string and it threw an exception. I muddled up a specific response to you about Integer with some more general observations about exceptions and Ruby. Sorry I wasn't clear: 1) Ruby documentation isn't perfect. You found a problem. 2) There are methods (i.e. Integer()) where exceptions are part of the expected behavior of the method and they *should* be documented. If they aren't, that is a bug not a feature. 3) Most Ruby methods don't say anything about exceptions because exceptions are not part of the API of most Ruby methods. There is an overall assumption that if you call a method without meeting the pre-conditions then the behavior (including the raising of exceptions) is undefined. 4) Pre-conditions should be clearly described by the documentation. Gary Wright