[#19684] Re: Odd TypeError in inject (1.9.1 preview 1) — Brian Candler <B.Candler@...>
[Apologies for broken threading, it shouldn't happen again]
On Tue, Nov 04, 2008 at 03:41:27PM +0900, Yukihiro Matsumoto wrote:
[#19710] build error with "nightly snapshot" — "Roger Pack" <rogerpack2005@...>
With mingw and the current 1.9 "nightly snapshot" I currently get
Hi,
> I think we've fixed this issue. Try again tomorrow.
Hi,
> It is curious. How are topdir extout defined in the Makefile?
[#19721] [Bug #719] yaml not precise on some strings — a b <redmine@...>
Bug #719: yaml not precise on some strings
[#19728] [Bug #721] select in windows accepts too many fd's — Roger Pack <redmine@...>
Bug #721: select in windows accepts too many fd's
[#19731] use of require thread safety — "Roger Pack" <rogerpack2005@...>
I'm sure this has been discussed before, but...should there be
Hi,
Nobuyoshi Nakada wrote:
Hi,
In article <E1LSOzO-0000HT-Q9@x61.netlab.jp>,
> While a thread is requiring a given file, another thread which
> Currently with 1.8.7 (for me) the secondmost thread continues
Roger Pack wrote:
Charles Oliver Nutter wrote:
Gary Wright wrote:
On Mon, Dec 22, 2008 at 03:05:07AM +0900, Charles Oliver Nutter wrote:
Paul Brannan wrote:
On Tue, Dec 23, 2008 at 02:14:52AM +0900, Charles Oliver Nutter wrote:
2008/12/23 Paul Brannan <pbrannan@atdesk.com>:
On Tue, Dec 23, 2008 at 11:32:00PM +0900, Robert Klemme wrote:
Paul Brannan wrote:
On Tue, Nov 11, 2008 at 10:51:45AM +0900, Nobuyoshi Nakada wrote:
Paul Brannan wrote:
On Wed, Nov 12, 2008 at 04:06:00AM +0900, Charles Oliver Nutter wrote:
Paul Brannan wrote:
Hi,
Yukihiro Matsumoto wrote:
Hi,
Yukihiro Matsumoto wrote:
[#19759] Proposal: Method#get_args — "Yehuda Katz" <wycats@...>
I'd like to propose a way to introspect into the arguments of a method
I am late to this discussion, but I am a bit concerned about the
On Thu, Dec 4, 2008 at 08:01, Paul McMahon <paul.mcmahon@ubit.com> wrote:
On Thu, Dec 04, 2008 at 10:02:29PM +0900, Daniel Luz wrote:
On Sun, Nov 9, 2008 at 5:46 PM, Yehuda Katz <wycats@gmail.com> wrote:
On Mon, Nov 10, 2008 at 5:32 AM, Austin Ziegler <halostatue@gmail.com>wrote:
On Mon, Nov 10, 2008 at 4:26 AM, Meinrad Recheis
On Mon, Nov 10, 2008 at 09:50:32PM +0900, Austin Ziegler wrote:
Hi,
Hi,
On Wed, Nov 12, 2008 at 03:58:48AM +0900, Nobuyoshi Nakada wrote:
> I'd like to propose a way to introspect into the arguments of a method
The only question I have is why would one want to know the names of
On Nov 10, 7:18=A0pm, "Roger Pack" <rogerpack2...@gmail.com> wrote:
> One could use it for documenting external interfaces. Eg. A command
On Mon, Nov 10, 2008 at 8:11 PM, Roger Pack <rogerpack2005@gmail.com> wrote:
> Is RubyVM::InstructionSequence considered portable?
On Mon, Nov 10, 2008 at 11:05 PM, Roger Pack <rogerpack2005@gmail.com> wrote:
Allow me to throw in my ~.116892074 DKK;
Mikael H淡ilund wrote:
On Wed, Nov 12, 2008 at 04:48:03AM +0900, Dave Thomas wrote:
On Wed, Nov 12, 2008 at 06:01:40PM +0900, Brian Candler wrote:
On Wed, Nov 12, 2008 at 06:01:40PM +0900, Brian Candler wrote:
Paul Brannan wrote:
On Thu, Nov 13, 2008 at 02:06:15AM +0900, Charles Oliver Nutter wrote:
Paul Brannan wrote:
> -----Original Message-----
On Thu, Nov 13, 2008 at 04:33:07AM +0900, Jim Deville wrote:
Jim Weirich wrote:
On Nov 12, 2008, at 4:12 PM, Charles Oliver Nutter wrote:
On Thu, Nov 13, 2008 at 07:02:25AM +0900, Jim Weirich wrote:
Hi,
Nobuyoshi Nakada wrote:
On Fri, Nov 14, 2008 at 03:30:44PM +0900, Charles Oliver Nutter wrote:
We need the defaults to handle out-of-order defaults:
On Fri, Nov 14, 2008 at 06:32:58PM +0900, Yehuda Katz wrote:
You were on the mark when you said it was a poor man's named args.
On Wed, Nov 12, 2008 at 12:06 PM, Charles Oliver Nutter
I am strongly in favor of this proposal. Getting something simple that
Hi,
Hi,
Hi,
What values does simple_default handle? Assuming it covers the simple cases
[#19760] ThreadGroup: << and Enumerable for POLS — paddor <paddor@...>
Hey
[#19763] [Bug #738] Repeated calls to popen cause thread problems — Michal Suchanek <redmine@...>
Bug #738: Repeated calls to popen cause thread problems
[#19784] Status of copy-on-write friendly garbage collector — Hongli Lai <hongli@...99.net>
Hi.
Hi.
Narihiro,
Hi,
Yukihiro Matsumoto wrote:
Hi,
I've contacted to the author, Dr. Ugawa, and he kindly sent me an
[#19819] Re: Definition of "Support levels", 1.9.1 supported platforms and recruitment for platform maintainers — Dae San Hwang <lists@...>
> The tasks which a maintainer should do are:
Hi,
[#19845] [Bug #743] Socket.gethostbyname returns odd values — Roger Pack <redmine@...>
Bug #743: Socket.gethostbyname returns odd values
Issue #743 has been updated by Alan Johnson.
Hi,
[#19846] [Bug #744] memory leak in callcc? — Roger Pack <redmine@...>
Bug #744: memory leak in callcc?
Issue #744 has been updated by Roger Pack.
Hi,
On Wednesday 21 of January 2009 10:21:19 Brent Roman wrote:
>> I've tried that myself but it didn't work very well
On Saturday 14 of February 2009 08:17:22 Roger Pack wrote:
> The moon has shifted phases since January :) Seriously though, I've also found
Hi,
> I pushed an update to the patches onto github last night that seems to
I am continuing to see random segfaults on x86_64, especially with god
2009/1/22 Brent Roman <brent@mbari.org>:
I have applied the MBARI patches to 1.8.6 p287. About half the hunks had to
On Thu, Jan 22, 2009 at 4:09 PM, Brent Roman <brent@mbari.org> wrote:
On Thursday 22 of January 2009 12:55:08 Brent Roman wrote:
I was attempting to backport your MBARI patches to 1.8.6 p287, which is what
Issue #744 has been updated by Roger Pack.
At 12:54 08/11/17, Brent Roman wrote:
A common technique is to allocate a reasonably sized array (256-bytes)
> I implemented a scheme for recording the maximum depth of the C stack in
First thanks for doing all that hard work. I'm sure it's not pleasant
Seems to overall be a tidge slower for "micro" stuff--5 or 10%.
> You ran this benchmark suite, correct?
Hmm interesting.
Brent,
Brent Roman wrote:
Brent Roman wrote:
On OSX -fomit-frame-pointer is turned off if you use -O2, or other
On Mon, 22 Dec 2008 20:59:05 +1100, Brent Roman <brent@mbari.org> wrote:
Hi,
The problem can be demonstrated with a very simple program (attached), and
> What I did come up with was not ugly at all. Factor the unwieldy switch
On Tue, Dec 02, 2008 at 04:47:46AM +0900, Brent Roman wrote:
At 06:56 08/12/02, Brian Candler wrote:
On Tue, Dec 02, 2008 at 10:21:05AM +0900, Martin Duerst wrote:
Hi,
> After a couple weeks of long nights and false starts, I feel I may have come
[#19921] flay is so awesome! — Ryan Davis <ryand-ruby@...>
I just found a typo in code in tk via flay! RAD!! This exists in trunk
2008/11/13 Ryan Davis <ryand-ruby@zenspider.com>:
[#19938] Fibers in 1.8 — "Aman Gupta" <rubytalk@...1.net>
Are there any plans to backport Fiber to ruby 1.8?
Hi,
> Fiber in 1.9 equals to Thread of 1.8.
On Wed, Nov 19, 2008 at 17:41, Aman Gupta <rubytalk@tmm1.net> wrote:
Brian Mitchell wrote:
On Wed, Nov 19, 2008 at 20:34, Urabe Shyouhei <shyouhei@ruby-lang.org> wrote:
[#19962] any ideas on why quoted parameters fail in mingw? — "Roger Pack" <rogerpack2005@...>
QW55Ym9keSBoYXZlIGFueSB0aG91Z2h0cyB3aHkKCmM6XGRldj5ydWJ5IC1lICIgXCIzXCIgIgot
T24gU3VuLCBOb3YgMTYsIDIwMDggYXQgMjo1OCBBTSwgUm9nZXIgUGFjayA8cm9nZXJwYWNrMjAw
SW50ZXJlc3RpbmcuCgpTby4uLm9mIG15IDMgd2luZG93cyBtYWNoaW5lcywgMiBpdCBmYWlscyBb
On Mon, Nov 17, 2008 at 11:10 AM, Roger Pack <rogerpack2005@gmail.com> wrote:
On Mon, Nov 17, 2008 at 7:35 AM, Luis Lavena <luislavena@gmail.com> wrote:
[#19965] ruby "[BUG] " and backtrace of native function call - addr2line - useless info — "=?ISO-8859-2?Q?Rados=B3aw_Bu=B3at?=" <radek.bulat@...>
SSBhdHRlbXB0IHRvIHVzZSBydWJ5MS45IGZyb20gdHJ1bmsgdG8gaGF2ZSBmdW4gd2l0aCBpdCBv
Rados梶w Buウat wrote:
[#19971] NULL pointer emerging from empty regexp match!? — Jens Wille <jens.wille@...>
hi!
[#19996] [BUG?] rdoc/ri on solaris 8 (i386 vs sparc) — Ben Walton <bwalton@...>
Hi All,
[#20008] [Bug #766] 'Not enough space' error on windows — Ittay Dror <redmine@...>
Bug #766: 'Not enough space' error on windows
[#20039] printing more output on unrescued exceptions — "Roger Pack" <rogerpack2005@...>
I have been contemplating creating a patch which would make the output
[#20046] ruby19 13% slower running rexml benchmark than ruby 1.8.6 p114 — Stephen Bannasch <stephen.bannasch@...>
I just added ruby 1.9 (svn rev 20317) to a simple xml processing
[#20047] 1.9 method argument binding question — "David A. Black" <dblack@...>
Hi --
[#20048] Unexpected Performance of Symbol Construction — Kurt Stephens <kurt@...>
http://kurtstephens.com/node/72
[#20071] Is missing documentation considered a bug? — Florian Gilcher <flo@...>
Hi,
[#20079] Again: Questions about Fiber behaviour — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <ed.odanow@...>
Hi!
[#20091] [Bug #796] dynamic constant assignment — Francois Proulx <redmine@...>
Bug #796: dynamic constant assignment
Hi,
> -----Original Message-----
[#20092] [Bug #797] bug or feature: local method ? — Francois Proulx <redmine@...>
Bug #797: bug or feature: local method ?
Hi,
Hi,
Yukihiro Matsumoto wrote:
On Thu, Nov 27, 2008 at 03:32:18AM +0900, Francoys wrote:
[#20125] Playing with String#bytes — Emiel van de Laar <emiel@...>
Hello ruby-core,
[#20129] Ruby class variable access from C — Christopher Thompson <cthompson@...>
I'm probably missing something trivial, but given the following Ruby code:
[#20161] \Z? in regular expression in 1.9.1 — Michael Klishin <michael.s.klishin@...>
I noticed that the following reg exp causes syntax error in 1.9.1 (I
T24gU2F0LCBOb3YgMjksIDIwMDggYXQgMTI6MTQgQU0sIE1pY2hhZWwgS2xpc2hpbgo8bWljaGFl
Hi,
Hi --
[ruby-core:19927] Re: {Proc,Method}#parameters (Re: Proposal: Method#get_args)
Hi,
At Thu, 13 Nov 2008 18:44:53 +0900,
Brian Candler wrote in [ruby-core:19915]:
> That does give me an idea. Since "?" is not legal in a variable name, then a
> very simple option could be
>
> def foo(a, b, c=123, d=nil, *e, &blk)
>
> => ["a", "b", "?c", "?d", "*e", "&blk"]
It's simplest.
> define_method(:bar) { |a,(b,c)| }
>
> => ["a", ["b", "c"]]
Is it really necessary?
Index: iseq.c
===================================================================
--- iseq.c (revision 20232)
+++ iseq.c (working copy)
@@ -1275,4 +1275,44 @@ rb_iseq_clone(VALUE iseqval, VALUE newcb
}
+VALUE
+rb_iseq_parameters(const rb_iseq_t *iseq)
+{
+ int i, r;
+ VALUE a, n, args = rb_ary_new2(iseq->arg_size);
+
+ for (i = 0; i < iseq->argc; i++) {
+ a = rb_id2str(iseq->local_table[i]);
+ rb_ary_push(args, a ? a : Qnil);
+ }
+ r = iseq->arg_rest != -1 ? iseq->arg_rest :
+ iseq->arg_post_len > 0 ? iseq->arg_post_start :
+ iseq->arg_block != -1 ? iseq->arg_block :
+ iseq->arg_size;
+ for (; i < r; i++) {
+ a = rb_id2str(iseq->local_table[i]);
+ n = rb_str_new2("?");
+ if (a) rb_str_append(n, a);
+ rb_ary_push(args, n);
+ }
+ if (iseq->arg_rest != -1) {
+ a = rb_id2str(iseq->local_table[iseq->arg_rest]);
+ n = rb_str_new2("*");
+ if (a) rb_str_append(n, a);
+ rb_ary_push(args, n);
+ }
+ r = iseq->arg_post_start + iseq->arg_post_len;
+ for (i = iseq->arg_post_start; i < r; i++) {
+ a = rb_id2str(iseq->local_table[i]);
+ rb_ary_push(args, a ? a : Qnil);
+ }
+ if (iseq->arg_block != -1) {
+ a = rb_id2str(iseq->local_table[iseq->arg_block]);
+ n = rb_str_new2("&");
+ if (a) rb_str_append(n, a);
+ rb_ary_push(args, n);
+ }
+ return args;
+}
+
/* ruby2cext */
Index: proc.c
===================================================================
--- proc.c (revision 20232)
+++ proc.c (working copy)
@@ -26,7 +26,10 @@ VALUE rb_cBinding;
VALUE rb_cProc;
+VALUE rb_iseq_parameters(const rb_iseq_t *iseq);
+
static VALUE bmcall(VALUE, VALUE);
static int method_arity(VALUE);
static VALUE rb_obj_is_method(VALUE m);
+static rb_iseq_t *get_method_iseq(VALUE method);
/* Proc */
@@ -616,6 +619,12 @@ get_proc_iseq(VALUE self)
GetProcPtr(self, proc);
iseq = proc->block.iseq;
- if (!RUBY_VM_NORMAL_ISEQ_P(iseq))
- return 0;
+ if (!RUBY_VM_NORMAL_ISEQ_P(iseq)) {
+ NODE *node = (NODE *)iseq;
+ iseq = 0;
+ if (nd_type(node) == NODE_IFUNC && node->nd_cfnc == bmcall) {
+ /* method(:foo).to_proc */
+ iseq = get_method_iseq(node->nd_tval);
+ }
+ }
return iseq;
}
@@ -651,4 +660,34 @@ rb_proc_location(VALUE self)
}
+static VALUE
+unnamed_parameters(int arity)
+{
+ VALUE param = rb_ary_new2((arity < 0) ? -arity : arity);
+ if (arity < 0) {
+ rb_ary_store(param, ~arity, rb_str_new2("*"));
+ }
+ else {
+ rb_ary_store(param, arity-1, Qnil);
+ }
+ return param;
+}
+
+/*
+ * call-seq:
+ * proc.parameters => array
+ *
+ * returns the parameter information of this proc
+ */
+
+static VALUE
+rb_proc_parameters(VALUE self)
+{
+ rb_iseq_t *iseq = get_proc_iseq(self);
+ if (!iseq) {
+ return unnamed_parameters(proc_arity(self));
+ }
+ return rb_iseq_parameters(iseq);
+}
+
/*
* call-seq:
@@ -1461,4 +1500,6 @@ get_method_iseq(VALUE method)
body = data->body;
switch (nd_type(body)) {
+ case NODE_BMETHOD:
+ return get_proc_iseq(body->nd_cval);
case RUBY_VM_METHOD_NODE:
GetISeqPtr((VALUE)body->nd_body, iseq);
@@ -1485,4 +1526,22 @@ rb_method_location(VALUE method)
/*
+ * call-seq:
+ * meth.parameters => array
+ *
+ * returns the parameter information of this method
+ * or nil if this method was not defined in ruby (i.e. native)
+ */
+
+static VALUE
+rb_method_parameters(VALUE method)
+{
+ rb_iseq_t *iseq = get_method_iseq(method);
+ if (!iseq) {
+ return unnamed_parameters(method_arity(method));
+ }
+ return rb_iseq_parameters(iseq);
+}
+
+/*
* call-seq:
* meth.to_s => string
@@ -1812,4 +1871,5 @@ Init_Proc(void)
rb_define_method(rb_cProc, "curry", proc_curry, -1);
rb_define_method(rb_cProc, "source_location", rb_proc_location, 0);
+ rb_define_method(rb_cProc, "parameters", rb_proc_parameters, 0);
/* Exceptions */
@@ -1847,4 +1907,5 @@ Init_Proc(void)
rb_define_method(rb_cMethod, "unbind", method_unbind, 0);
rb_define_method(rb_cMethod, "source_location", rb_method_location, 0);
+ rb_define_method(rb_cMethod, "parameters", rb_method_parameters, 0);
rb_define_method(rb_mKernel, "method", rb_obj_method, 1);
rb_define_method(rb_mKernel, "public_method", rb_obj_public_method, 1);
@@ -1865,4 +1926,5 @@ Init_Proc(void)
rb_define_method(rb_cUnboundMethod, "bind", umethod_bind, 1);
rb_define_method(rb_cUnboundMethod, "source_location", rb_method_location, 0);
+ rb_define_method(rb_cUnboundMethod, "parameters", rb_method_parameters, 0);
/* Module#*_method */
Index: test/ruby/test_method.rb
===================================================================
--- test/ruby/test_method.rb (revision 20232)
+++ test/ruby/test_method.rb (working copy)
@@ -21,4 +21,6 @@ class TestMethod < Test::Unit::TestCase
def mo5(a, *b, c) end
def mo6(a, *b, c, &d) end
+ def mo7(a, b = nil, *c, d, &e) end
+ def ma1((a), &b) end
class Base
@@ -222,3 +224,71 @@ class TestMethod < Test::Unit::TestCase
assert_raise(ArgumentError) { o.method(:foo).call(1) }
end
+
+ define_method(:pm0) {||}
+ define_method(:pm1) {|a|}
+ define_method(:pm2) {|a, b|}
+ define_method(:pmo1) {|a = nil, &b|}
+ define_method(:pmo2) {|a, b = nil|}
+ define_method(:pmo3) {|*a|}
+ define_method(:pmo4) {|a, *b, &c|}
+ define_method(:pmo5) {|a, *b, c|}
+ define_method(:pmo6) {|a, *b, c, &d|}
+ define_method(:pmo7) {|a, b = nil, *c, d, &e|}
+ define_method(:pma1) {|(a), &b|}
+
+ def test_bound_parameters
+ assert_equal(%w(), method(:m0).parameters)
+ assert_equal(%w(a), method(:m1).parameters)
+ assert_equal(%w(a b), method(:m2).parameters)
+ assert_equal(%w(?a &b), method(:mo1).parameters)
+ assert_equal(%w(a ?b), method(:mo2).parameters)
+ assert_equal(%w(*a), method(:mo3).parameters)
+ assert_equal(%w(a *b &c), method(:mo4).parameters)
+ assert_equal(%w(a *b c), method(:mo5).parameters)
+ assert_equal(%w(a *b c &d), method(:mo6).parameters)
+ assert_equal(%w(a ?b *c d &e), method(:mo7).parameters)
+ assert_equal([nil, "&b"], method(:ma1).parameters)
+ end
+
+ def test_unbound_parameters
+ assert_equal(%w(), self.class.instance_method(:m0).parameters)
+ assert_equal(%w(a), self.class.instance_method(:m1).parameters)
+ assert_equal(%w(a b), self.class.instance_method(:m2).parameters)
+ assert_equal(%w(?a &b), self.class.instance_method(:mo1).parameters)
+ assert_equal(%w(a ?b), self.class.instance_method(:mo2).parameters)
+ assert_equal(%w(*a), self.class.instance_method(:mo3).parameters)
+ assert_equal(%w(a *b &c), self.class.instance_method(:mo4).parameters)
+ assert_equal(%w(a *b c), self.class.instance_method(:mo5).parameters)
+ assert_equal(%w(a *b c &d), self.class.instance_method(:mo6).parameters)
+ assert_equal(%w(a ?b *c d &e), self.class.instance_method(:mo7).parameters)
+ assert_equal([nil, "&b"], self.class.instance_method(:ma1).parameters)
+ end
+
+ def test_bmethod_bound_parameters
+ assert_equal(%w(), method(:pm0).parameters)
+ assert_equal(%w(a), method(:pm1).parameters)
+ assert_equal(%w(a b), method(:pm2).parameters)
+ assert_equal(%w(?a &b), method(:pmo1).parameters)
+ assert_equal(%w(a ?b), method(:pmo2).parameters)
+ assert_equal(%w(*a), method(:pmo3).parameters)
+ assert_equal(%w(a *b &c), method(:pmo4).parameters)
+ assert_equal(%w(a *b c), method(:pmo5).parameters)
+ assert_equal(%w(a *b c &d), method(:pmo6).parameters)
+ assert_equal(%w(a ?b *c d &e), method(:pmo7).parameters)
+ assert_equal([nil, "&b"], method(:pma1).parameters)
+ end
+
+ def test_bmethod_unbound_parameters
+ assert_equal(%w(), self.class.instance_method(:pm0).parameters)
+ assert_equal(%w(a), self.class.instance_method(:pm1).parameters)
+ assert_equal(%w(a b), self.class.instance_method(:pm2).parameters)
+ assert_equal(%w(?a &b), self.class.instance_method(:pmo1).parameters)
+ assert_equal(%w(a ?b), self.class.instance_method(:pmo2).parameters)
+ assert_equal(%w(*a), self.class.instance_method(:pmo3).parameters)
+ assert_equal(%w(a *b &c), self.class.instance_method(:pmo4).parameters)
+ assert_equal(%w(a *b c), self.class.instance_method(:pmo5).parameters)
+ assert_equal(%w(a *b c &d), self.class.instance_method(:pmo6).parameters)
+ assert_equal(%w(a ?b *c d &e), self.class.instance_method(:pmo7).parameters)
+ assert_equal([nil, "&b"], self.class.instance_method(:pma1).parameters)
+ end
end
Index: test/ruby/test_proc.rb
===================================================================
--- test/ruby/test_proc.rb (revision 20232)
+++ test/ruby/test_proc.rb (working copy)
@@ -674,3 +674,46 @@ class TestProc < Test::Unit::TestCase
assert_equal([1,2,[3],4,5], r, "[ruby-core:19485]")
end
+
+ def test_parameters
+ assert_equal(%w(), proc {}.parameters)
+ assert_equal(%w(), proc {||}.parameters)
+ assert_equal(%w(a), proc {|a|}.parameters)
+ assert_equal(%w(a b), proc {|a, b|}.parameters)
+ assert_equal(%w(?a &b), proc {|a=:a, &b|}.parameters)
+ assert_equal(%w(a ?b), proc {|a, b=:b|}.parameters)
+ assert_equal(%w(*a), proc {|*a|}.parameters)
+ assert_equal(%w(a *b &c), proc {|a, *b, &c|}.parameters)
+ assert_equal(%w(a *b c), proc {|a, *b, c|}.parameters)
+ assert_equal(%w(a *b c &d), proc {|a, *b, c, &d|}.parameters)
+ assert_equal(%w(a ?b *c d &e), proc {|a, b=:b, *c, d, &e|}.parameters)
+ assert_equal([nil, "&b"], proc {|(a), &b|}.parameters)
+ assert_equal(%w[a b ?c ?d *e f g &h], proc {|a,b,c=:c,d=:d,*e,f,g,&h|}.parameters)
+ end
+
+ def pm0() end
+ def pm1(a) end
+ def pm2(a, b) end
+ def pmo1(a = nil, &b) end
+ def pmo2(a, b = nil) end
+ def pmo3(*a) end
+ def pmo4(a, *b, &c) end
+ def pmo5(a, *b, c) end
+ def pmo6(a, *b, c, &d) end
+ def pmo7(a, b = nil, *c, d, &e) end
+ def pma1((a), &b) end
+
+
+ def test_bound_parameters
+ assert_equal(%w(), method(:pm0).to_proc.parameters)
+ assert_equal(%w(a), method(:pm1).to_proc.parameters)
+ assert_equal(%w(a b), method(:pm2).to_proc.parameters)
+ assert_equal(%w(?a &b), method(:pmo1).to_proc.parameters)
+ assert_equal(%w(a ?b), method(:pmo2).to_proc.parameters)
+ assert_equal(%w(*a), method(:pmo3).to_proc.parameters)
+ assert_equal(%w(a *b &c), method(:pmo4).to_proc.parameters)
+ assert_equal(%w(a *b c), method(:pmo5).to_proc.parameters)
+ assert_equal(%w(a *b c &d), method(:pmo6).to_proc.parameters)
+ assert_equal(%w(a ?b *c d &e), method(:pmo7).to_proc.parameters)
+ assert_equal([nil, "&b"], method(:pma1).to_proc.parameters)
+ end
end
--
Nobu Nakada