tag:blogger.com,1999:blog-9905395.post6084650803975560789..comments2023-06-13T02:09:57.338-06:00Comments on David Rupp's Blog: Hacking JRuby: BigDecimal and Ruby InternalsDavid Rupphttp://www.blogger.com/profile/16410820024654313029noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-9905395.post-86913268445188187832007-06-12T17:03:00.000-06:002007-06-12T17:03:00.000-06:00Thanks, Ola (for the compliment and for the inform...Thanks, Ola (for the compliment and for the information about Arity). I'll take a look at the codebase and see if I can use checkArgumentCount() and/or scanArgs() to help with my class-method-with-opt-args problem.David Rupphttps://www.blogger.com/profile/16410820024654313029noreply@blogger.comtag:blogger.com,1999:blog-9905395.post-22732018200217197042007-06-12T13:28:00.000-06:002007-06-12T13:28:00.000-06:00Hi David. Good work on the BigDecimal patch.So, we...Hi David. Good work on the BigDecimal patch.<BR/><BR/>So, we do actually have two different ways of handling argument checking. Both are static methods on org.jruby.runtime.Arity.<BR/><BR/>The first fine is called checkArgumentCount; this takes a runtime, the args array, minimum arguments and maximum arguments. The method will throw an appropriate exception if the argument array it gets is incorrect.<BR/><BR/>The second version is called scanArgs, and takes the runtime, the argument array, a count of required and a count of optional, and will return an array of length required+optional, with all arguments set, and the rest set to nil.<BR/><BR/>None of these handles rest arguments, of course; you'll have to do that yourself.Ola Binihttps://www.blogger.com/profile/15793488672952593953noreply@blogger.com