On Tue, Aug 08, 2000 at 09:38:22AM -0700, Nathan Wiger wrote:
> > > foo($x ||= 10, $y ||= 20);
> >
> > That already has a meaning ... I tend to favor syntax that doesn't
> > already have meaning
>
> It does have meaning, but I think that's a plus. Currently, it doesn't
> actually do anything (even in 5.6):
>
> perl -e '
> sub foo ($x ||= 20) {
> print "x = $x\n";
> }
> &foo;
> '
> x =
Er, I thought we were talking about setting named parameters, not
default values.
sub foo ($name = 'Fred', $age = 32) { # defaults
# do stuff with $name and $age
}
foo('Barney', 31); # Positional assignment
foo($age:31, $name:'Betty'); # Named assignment
foo($age:=31, $name:='Betty'); # Named assignment v2
foo($age||=31, $name||='Betty'); # NO
foo($age=>31, $name=>'Betty'); # NO, etc.
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]
- Re: RFC 57 (v1) Subroutine prototypes and paramet... Bart Lateur
- Re: RFC 57 (v1) Subroutine prototypes and par... Jacob Davies
- Re: RFC 57 (v1) Subroutine prototypes and... Bart Lateur
- Re: RFC 57 (v1) Subroutine prototypes... Nathan Wiger
- Re: RFC 57 (v1) Subroutine proto... Andy Wardley
- Re: RFC 57 (v1) Subroutine p... Bart Lateur
- Re: RFC 57 (v1) Subroutine p... Andy Wardley
- Re: RFC 57 (v1) Subroutine p... Nathan Wiger
- Re: RFC 57 (v1) Subroutine p... Jonathan Scott Duff
- Re: RFC 57 (v1) Subroutine p... Nathan Wiger
- Re: RFC 57 (v1) Subroutine p... Jonathan Scott Duff
- Re: RFC 57 (v1) Subroutine p... Nathan Wiger
- Re: RFC 57 (v1) Subroutine p... Jonathan Scott Duff
- Re: RFC 57 (v1) Subroutine p... Bart Lateur
- Re: RFC 57 (v1) Subroutine p... Andy Wardley
- Re: RFC 57 (v1) Subroutine p... Bart Lateur
- Re: RFC 57 (v1) Subroutine prototypes and... Jonathan Scott Duff
- Re: RFC 57 (v1) Subroutine prototypes and paramet... Chaim Frenkel
- Re: RFC 57 (v1) Subroutine prototypes and parameters H.Merijn Brand
