Optional binding
What is output: sub foo($x, ?$y, [EMAIL PROTECTED]) { say x = $x; y = $y; z = @z[]; } my @a = (1,2,3); foo($x, @a); Thanks, Luke
Re: Optional binding
Luke Palmer [EMAIL PROTECTED] wrote: What is output: sub foo($x, ?$y, [EMAIL PROTECTED]) { say x = $x; y = $y; z = @z[]; } my @a = (1,2,3); foo($x, @a); IANALarry, but I'd think x = ($x's value); y = 1 2 3; z = The $y is implicitly typed Any, and Ref of Array (or maybe just Array) is consistent with Any; hence $y receives [EMAIL PROTECTED] -- Brent 'Dax' Royal-Gordon [EMAIL PROTECTED] Perl and Parrot hacker I used to have a life, but I liked mail-reading so much better.
[RELEASE] Parrot 0.1.2 Phoenix Released!
On behalf of the Parrot team I'm proud to announce the release of Parrot 0.1.2. What is Parrot? Parrot is a virtual machine aimed at running Perl6 and other dynamic languages. Parrot 0.1.2 contains a lot of new stuff: - New string handling code. Strings now have charset and encoding - Parts of a generational garbage collector - Better Python support, separated into dynclasses - Parrot Grammar Engine - Improved test coverage and documentation - and a lot more After some pause you can grab it from http://www.cpan.org/authors/id/L/LT/LTOETSCH/parrot-0.1.2.tar.gz. As parrot is still in steady development we recommend that you just get the latest and best from CVS by following the directions at http://dev.perl.org/cvs/. Turn your web browser towards http://www.parrotcode.org/ for more information about Parrot, get involved, and: Have fun! leo
Re: [RELEASE] Parrot 0.1.2 Phoenix Released!
Ok, this might be useless, but maybe you like to know: All tests successful, 1 test and 64 subtests skipped. Files=135, Tests=2252, 798 wallclock secs (299.99 cusr + 96.80 csys = 396.79 CPU) On a PIII 1Ghz/256MB RAM, running Slackware Linux Cheers, Alberto Leopold Toetsch wrote: On behalf of the Parrot team I'm proud to announce the release of Parrot 0.1.2. What is Parrot? Parrot is a virtual machine aimed at running Perl6 and other dynamic languages. Parrot 0.1.2 contains a lot of new stuff: - New string handling code. Strings now have charset and encoding - Parts of a generational garbage collector - Better Python support, separated into dynclasses - Parrot Grammar Engine - Improved test coverage and documentation - and a lot more After some pause you can grab it from http://www.cpan.org/authors/id/L/LT/LTOETSCH/parrot-0.1.2.tar.gz. As parrot is still in steady development we recommend that you just get the latest and best from CVS by following the directions at http://dev.perl.org/cvs/. Turn your web browser towards http://www.parrotcode.org/ for more information about Parrot, get involved, and: Have fun! leo -- Alberto Simões - Departamento de Informática - Universidade do Minho ,,__ .. .. / o._) .---. /--'/--\ \-'||...' '. /\_/ / | .' '..' '-. .'\ \__\ __.'.' .' ì-._ )\ | )\ | _.' // \\ // \\ ||_ \\|_ \\_ Perl Monger mrf '--' '--'' '--'www.perl-hackers.net
Re: Optional binding
On Sun, Mar 06, 2005 at 02:13:09 -0700, Luke Palmer wrote: What is output: sub foo($x, ?$y, [EMAIL PROTECTED]) { say x = $x; y = $y; z = @z[]; } my @a = (1,2,3); foo($x, @a); And is $a == foo $x; The same? -- () Yuval Kogman [EMAIL PROTECTED] 0xEBD27418 perl hacker /\ kung foo master: /me groks YAML like the grasshopper: neeyah!! pgpIDUildkBFf.pgp Description: PGP signature
Re: Optional binding
On Sun, Mar 06, 2005 at 02:13:09AM -0700, Luke Palmer wrote: : What is output: : : sub foo($x, ?$y, [EMAIL PROTECTED]) { : say x = $x; y = $y; z = @z[]; : } : : my @a = (1,2,3); : foo($x, @a); I think it should say something like: Use of undefined value at foo line 2 x = ; y = 1 2 3; z = Optional parameters are greedy, and @a means [EMAIL PROTECTED] in a scalar context. Larry