[#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:19955] Re: Proposal: Method#get_args
Agreed. What we need is a special sentinel value (I originally =20
proposed Method::EXPRESSION)
Sent from my iPhone
On Nov 15, 2008, at 12:53 PM, Nobuyoshi Nakada <nobu@ruby-lang.org> =20
wrote:
> Hi,
>
> At Sun, 16 Nov 2008 00:48:54 +0900,
> Yukihiro Matsumoto wrote in [ruby-core:19942]:
>> |I guess so. I'd like to make sure two more things:
>> |
>> | * symbol for block argument should be :block, or anything else?
>> | * if you don't have a rest argument name, you will get [:rest], =20=
>> ok?
>>
>> One more:
>>
>>> def foo(a, b =3D 1, *c, d)
>>> =3D> [[:req, :a], [:opt, :b, 1], [:rest, :c], [:req, :d]]
>>
>> what if the default value for an optional argument is more than a =20
>> simple
>> literal? :expr as Austine mentioned in [ruby-core:19882]? Or drop
>> default values altogether?
>
> Since :expr is a valid expression, I don't think it is
> reasonable.
>
> =0C
> Index: iseq.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- iseq.c (revision 20237)
> +++ iseq.c (working copy)
> @@ -1275,4 +1275,67 @@ rb_iseq_clone(VALUE iseqval, VALUE newcb
> }
>
> +static VALUE
> +simple_default_value(const VALUE *seq)
> +{
> + VALUE val;
> + switch (*seq++) {
> + case BIN(putnil):
> + val =3D Qnil;
> + case BIN(putobject):
> + val =3D *seq++;
> + if (*seq =3D=3D BIN(setlocal)) break;
> + default:
> + return Qundef;
> + }
> + return val;
> +}
> +
> +VALUE
> +rb_iseq_parameters(const rb_iseq_t *iseq)
> +{
> + int i, r, s;
> + VALUE a, args =3D rb_ary_new2(iseq->arg_size);
> + ID req, opt, rest, block;
> +#define PARAM_TYPE(type) rb_ary_push(a =3D rb_ary_new2(2), =20
> ID2SYM(type))
> +#define PARAM_ID(i) iseq->local_table[i]
> +#define PARAM(i, type) ( \
> + PARAM_TYPE(type), \
> + rb_id2name(PARAM_ID(i)) ? \
> + rb_ary_push(a, ID2SYM(PARAM_ID(i))) : \
> + a)
> +
> + CONST_ID(req, "req");
> + for (i =3D 0; i < iseq->argc; i++) {
> + rb_ary_push(args, PARAM(i, req));
> + }
> + r =3D iseq->arg_rest !=3D -1 ? iseq->arg_rest :
> + iseq->arg_post_len > 0 ? iseq->arg_post_start :
> + iseq->arg_block !=3D -1 ? iseq->arg_block :
> + iseq->arg_size;
> + CONST_ID(opt, "opt");
> + for (s =3D i; i < r; i++) {
> + PARAM_TYPE(opt);
> + if (rb_id2name(PARAM_ID(i))) {
> + VALUE defval =3D simple_default_value(iseq->iseq + iseq-=20
> >arg_opt_table[i-s]);
> + rb_ary_push(a, ID2SYM(PARAM_ID(i)));
> + if (defval !=3D Qundef) rb_ary_push(a, defval);
> + }
> + rb_ary_push(args, a);
> + }
> + if (iseq->arg_rest !=3D -1) {
> + CONST_ID(rest, "rest");
> + rb_ary_push(args, PARAM(iseq->arg_rest, rest));
> + }
> + r =3D iseq->arg_post_start + iseq->arg_post_len;
> + for (i =3D iseq->arg_post_start; i < r; i++) {
> + rb_ary_push(args, PARAM(i, req));
> + }
> + if (iseq->arg_block !=3D -1) {
> + CONST_ID(block, "block");
> + rb_ary_push(args, PARAM(iseq->arg_block, block));
> + }
> + return args;
> +}
> +
> /* ruby2cext */
>
> Index: proc.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- proc.c (revision 20237)
> +++ 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 =3D proc->block.iseq;
> - if (!RUBY_VM_NORMAL_ISEQ_P(iseq))
> - return 0;
> + if (!RUBY_VM_NORMAL_ISEQ_P(iseq)) {
> + NODE *node =3D (NODE *)iseq;
> + iseq =3D 0;
> + if (nd_type(node) =3D=3D NODE_IFUNC && node->nd_cfnc =3D=3D =
bmcall) {
> + /* method(:foo).to_proc */
> + iseq =3D get_method_iseq(node->nd_tval);
> + }
> + }
> return iseq;
> }
> @@ -651,4 +660,40 @@ rb_proc_location(VALUE self)
> }
>
> +static VALUE
> +unnamed_parameters(int arity)
> +{
> + VALUE a, param =3D rb_ary_new2((arity < 0) ? -arity : arity);
> + int n =3D (arity < 0) ? ~arity : arity;
> + ID req, rest;
> + CONST_ID(req, "req");
> + a =3D rb_ary_new3(1, ID2SYM(req));
> + OBJ_FREEZE(a);
> + for (; n; --n) {
> + rb_ary_push(param, a);
> + }
> + if (arity < 0) {
> + CONST_ID(rest, "rest");
> + rb_ary_store(param, ~arity, rb_ary_new3(1, ID2SYM(rest)));
> + }
> + return param;
> +}
> +
> +/*
> + * call-seq:
> + * proc.parameters =3D> array
> + *
> + * returns the parameter information of this proc
> + */
> +
> +static VALUE
> +rb_proc_parameters(VALUE self)
> +{
> + rb_iseq_t *iseq =3D get_proc_iseq(self);
> + if (!iseq) {
> + return unnamed_parameters(proc_arity(self));
> + }
> + return rb_iseq_parameters(iseq);
> +}
> +
> /*
> * call-seq:
> @@ -1461,4 +1506,6 @@ get_method_iseq(VALUE method)
> body =3D 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 +1532,21 @@ rb_method_location(VALUE method)
>
> /*
> + * call-seq:
> + * meth.parameters =3D> array
> + *
> + * returns the parameter information of this method
> + */
> +
> +static VALUE
> +rb_method_parameters(VALUE method)
> +{
> + rb_iseq_t *iseq =3D get_method_iseq(method);
> + if (!iseq) {
> + return unnamed_parameters(method_arity(method));
> + }
> + return rb_iseq_parameters(iseq);
> +}
> +
> +/*
> * call-seq:
> * meth.to_s =3D> string
> @@ -1812,4 +1876,5 @@ Init_Proc(void)
> rb_define_method(rb_cProc, "curry", proc_curry, -1);
> rb_define_method(rb_cProc, "source_location", rb_proc_location, =20=
> 0);
> + rb_define_method(rb_cProc, "parameters", rb_proc_parameters, 0);
>
> /* Exceptions */
> @@ -1847,4 +1912,5 @@ Init_Proc(void)
> rb_define_method(rb_cMethod, "unbind", method_unbind, 0);
> rb_define_method(rb_cMethod, "source_location", =20
> rb_method_location, 0);
> + rb_define_method(rb_cMethod, "parameters", =20
> rb_method_parameters, 0);
> rb_define_method(rb_mKernel, "method", rb_obj_method, 1);
> rb_define_method(rb_mKernel, "public_method", =20
> rb_obj_public_method, 1);
> @@ -1865,4 +1931,5 @@ Init_Proc(void)
> rb_define_method(rb_cUnboundMethod, "bind", umethod_bind, 1);
> rb_define_method(rb_cUnboundMethod, "source_location", =20
> rb_method_location, 0);
> + rb_define_method(rb_cUnboundMethod, "parameters", =20
> rb_method_parameters, 0);
>
> /* Module#*_method */
> Index: test/ruby/test_proc.rb
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- test/ruby/test_proc.rb (revision 20237)
> +++ 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([], proc {}.parameters)
> + assert_equal([], proc {||}.parameters)
> + assert_equal([[:req, :a]], proc {|a|}.parameters)
> + assert_equal([[:req, :a], [:req, :b]], proc {|a, b|}.parameters)
> + assert_equal([[:opt, :a, :a], [:block, :b]], proc {|a=3D:a, =20
> &b|}.parameters)
> + assert_equal([[:req, :a], [:opt, :b, :b]], proc {|a, =20
> b=3D:b|}.parameters)
> + assert_equal([[:rest, :a]], proc {|*a|}.parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:block, :c]], proc {|a, =20=
> *b, &c|}.parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c]], proc {|a, =20
> *b, c|}.parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c], =20
> [:block, :d]], proc {|a, *b, c, &d|}.parameters)
> + assert_equal([[:req, :a], [:opt, :b, :b], [:rest, :c], =20
> [:req, :d], [:block, :e]], proc {|a, b=3D:b, *c, d, &e|}.parameters)
> + assert_equal([[:req], [:block, :b]], proc {|(a), &b|}.parameters)
> + assert_equal([[:req, :a], [:req, :b], [:opt, :c, :c], =20
> [:opt, :d, :d], [:rest, :e], [:req, :f], [:req, :g], [:block, :h]], =20=
> proc {|a,b,c=3D:c,d=3D:d,*e,f,g,&h|}.parameters)
> + end
> +
> + def pm0() end
> + def pm1(a) end
> + def pm2(a, b) end
> + def pmo1(a =3D :a, &b) end
> + def pmo2(a, b =3D :b) 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 =3D :b, *c, d, &e) end
> + def pma1((a), &b) end
> +
> +
> + def test_bound_parameters
> + assert_equal([], method(:pm0).to_proc.parameters)
> + assert_equal([[:req, :a]], method(:pm1).to_proc.parameters)
> + assert_equal([[:req, :a], [:req, :b]], =20
> method(:pm2).to_proc.parameters)
> + assert_equal([[:opt, :a, :a], [:block, :b]], =20
> method(:pmo1).to_proc.parameters)
> + assert_equal([[:req, :a], [:opt, :b, :b]], =20
> method(:pmo2).to_proc.parameters)
> + assert_equal([[:rest, :a]], method(:pmo3).to_proc.parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:block, :c]], =20
> method(:pmo4).to_proc.parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c]], =20
> method(:pmo5).to_proc.parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c], =20
> [:block, :d]], method(:pmo6).to_proc.parameters)
> + assert_equal([[:req, :a], [:opt, :b, :b], [:rest, :c], =20
> [:req, :d], [:block, :e]], method(:pmo7).to_proc.parameters)
> + assert_equal([[:req], [:block, :b]], =20
> method(:pma1).to_proc.parameters)
> + end
> end
> Index: test/ruby/test_method.rb
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- test/ruby/test_method.rb (revision 20237)
> +++ 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 =3D 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 =3D nil, &b|}
> + define_method(:pmo2) {|a, b =3D 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 =3D nil, *c, d, &e|}
> + define_method(:pma1) {|(a), &b|}
> +
> + def test_bound_parameters
> + assert_equal([], method(:m0).parameters)
> + assert_equal([[:req, :a]], method(:m1).parameters)
> + assert_equal([[:req, :a], [:req, :b]], method(:m2).parameters)
> + assert_equal([[:opt, :a, nil], [:block, :b]], =20
> method(:mo1).parameters)
> + assert_equal([[:req, :a], [:opt, :b, nil]], =20
> method(:mo2).parameters)
> + assert_equal([[:rest, :a]], method(:mo3).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:block, :c]], =20
> method(:mo4).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c]], =20
> method(:mo5).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c], =20
> [:block, :d]], method(:mo6).parameters)
> + assert_equal([[:req, :a], [:opt, :b, nil], [:rest, :c], =20
> [:req, :d], [:block, :e]], method(:mo7).parameters)
> + assert_equal([[:req], [:block, :b]], method(:ma1).parameters)
> + end
> +
> + def test_unbound_parameters
> + assert_equal([], self.class.instance_method(:m0).parameters)
> + assert_equal([[:req, :a]], =20
> self.class.instance_method(:m1).parameters)
> + assert_equal([[:req, :a], [:req, :b]], =20
> self.class.instance_method(:m2).parameters)
> + assert_equal([[:opt, :a, nil], [:block, :b]], =20
> self.class.instance_method(:mo1).parameters)
> + assert_equal([[:req, :a], [:opt, :b, nil]], =20
> self.class.instance_method(:mo2).parameters)
> + assert_equal([[:rest, :a]], =20
> self.class.instance_method(:mo3).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:block, :c]], =20
> self.class.instance_method(:mo4).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c]], =20
> self.class.instance_method(:mo5).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c], =20
> [:block, :d]], self.class.instance_method(:mo6).parameters)
> + assert_equal([[:req, :a], [:opt, :b, nil], [:rest, :c], =20
> [:req, :d], [:block, :e]], =20
> self.class.instance_method(:mo7).parameters)
> + assert_equal([[:req], [:block, :b]], =20
> self.class.instance_method(:ma1).parameters)
> + end
> +
> + def test_bmethod_bound_parameters
> + assert_equal([], method(:pm0).parameters)
> + assert_equal([[:req, :a]], method(:pm1).parameters)
> + assert_equal([[:req, :a], [:req, :b]], method(:pm2).parameters)
> + assert_equal([[:opt, :a, nil], [:block, :b]], =20
> method(:pmo1).parameters)
> + assert_equal([[:req, :a], [:opt, :b, nil]], =20
> method(:pmo2).parameters)
> + assert_equal([[:rest, :a]], method(:pmo3).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:block, :c]], =20
> method(:pmo4).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c]], =20
> method(:pmo5).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c], =20
> [:block, :d]], method(:pmo6).parameters)
> + assert_equal([[:req, :a], [:opt, :b, nil], [:rest, :c], =20
> [:req, :d], [:block, :e]], method(:pmo7).parameters)
> + assert_equal([[:req], [:block, :b]], method(:pma1).parameters)
> + end
> +
> + def test_bmethod_unbound_parameters
> + assert_equal([], self.class.instance_method(:pm0).parameters)
> + assert_equal([[:req, :a]], =20
> self.class.instance_method(:pm1).parameters)
> + assert_equal([[:req, :a], [:req, :b]], =20
> self.class.instance_method(:pm2).parameters)
> + assert_equal([[:opt, :a, nil], [:block, :b]], =20
> self.class.instance_method(:pmo1).parameters)
> + assert_equal([[:req, :a], [:opt, :b, nil]], =20
> self.class.instance_method(:pmo2).parameters)
> + assert_equal([[:rest, :a]], =20
> self.class.instance_method(:pmo3).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:block, :c]], =20
> self.class.instance_method(:pmo4).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c]], =20
> self.class.instance_method(:pmo5).parameters)
> + assert_equal([[:req, :a], [:rest, :b], [:req, :c], =20
> [:block, :d]], self.class.instance_method(:pmo6).parameters)
> + assert_equal([[:req, :a], [:opt, :b, nil], [:rest, :c], =20
> [:req, :d], [:block, :e]], =20
> self.class.instance_method(:pmo7).parameters)
> + assert_equal([[:req], [:block, :b]], =20
> self.class.instance_method(:pma1).parameters)
> + end
> end
> =0C
>
> --=20
> Nobu Nakada
>