[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:03968] Re: Are named formal parameters in recent r uby interpreters?

From: ts <decoux@...>
Date: 2000-07-13 11:41:56 UTC
List: ruby-talk #3968
>>>>> "A" == Aleksi Niemel=E4?= <iso-8859-1> writes:

A> Isn't it even more. The named vars (maybe have to be in the end and) are
A> collected into a hash which is passed to a subroutine as a last parameter.
A> (That is last before optional block, I think).

 You can have *args, after an assoc. From parse.y :


                | assocs ','
                    {
                        $$ = NEW_LIST(NEW_HASH($1));
                    }
                | assocs opt_block_arg
                    {
                        $$ = NEW_LIST(NEW_HASH($1));
                        $$ = arg_blk_pass($$, $2);
                    }
                | assocs ',' tSTAR arg opt_block_arg
                    {
                        $$ = arg_concat(NEW_LIST(NEW_HASH($1)), $4);
                        $$ = arg_blk_pass($$, $5);
                    }
                | args ',' assocs opt_block_arg
                    {
                        $$ = list_append($1, NEW_HASH($3));
                        $$ = arg_blk_pass($$, $4);
                    }
                | args ',' assocs ','
                    {
                        $$ = list_append($1, NEW_HASH($3));
                    }
                | args ',' assocs ',' tSTAR arg opt_block_arg
                    {
                        $$ = arg_concat(list_append($1, NEW_HASH($3)), $6);
                        $$ = arg_blk_pass($$, $7);
                    }


Guy Decoux

In This Thread

Prev Next