Allow me to throw in my ~.116892074 DKK;
I'm in favor of using a class for representing the parameter data.
It'll allow for methods like allows?(some, arguments), which will tell ou if calling the method with those arguments will throw an
ArgumentError or not. This might, however, be better suited to be in
the Method/UnboundMethod class.
It will also make handling of the returned object much prettier. I'd
much rather see
method(:foo).parameters.names.include? :some_param
than
method(:foo).parameters.any? { |param| param.include? :some_param if
param.kind_of? Array }
or however it would be represented. Similarly, what expresses what you ant the most; `parameters.takes_block?` or `!parameters.last.nil?`?
I'm also in favor of supplying the default value. In far the most
cases the default value is nil (in my experience), but not always.
This means I'll have to look up the method (don't get me started on if he method is dynamically generated) just to pass an optional argument hat follows another optional argument I don't want to change.
Default values, however, I can see becoming a bit of a hassle. Unless t's to be represented as a string of Ruby code, cases like `def foo
bar, baz = "default-#{bar}"` will be quite difficult to express, let lone in a way that's easy and nice to handle.
Ultimately, I'd like to propose that the parameters method also be
added to the Proc class.
--
# Mikael Høélund
def method_missing(m, a=0) a +
m.to_s[/[a-z]+/].size * 2; end
p What is the meaning of life?