--- Deborah Ariel Pickett <[EMAIL PROTECTED]> wrote:
> Ah . . . one message with two things I wanted to talk about.  Good.
> 
> Allison wrote:
> > On Tue, Nov 19, 2002 at 01:24:30PM -0800, Austin Hastings wrote:
> > > So what's wrong with:
> > > 
> > > sub foo($param is topic //= $= // 5)    # Shorter form with $=
> > > sub foo($param is topic //= $CALLER::_ // 5) 
>                             ^^^
> Don't I recall Larry saying that C< //= > for setting a parameter's
> default value was a Bad Idea, because it means that you can't
> explicitly
> pass C<undef> to foo()?  I thought it'd been changed to C< = > for
> that
> reason.
> 
> Or is this piece of code doing something different?

Maybe. This code says "if $param is undef, pull the value from
$CALLER::_. If THAT is undef, it's 5."

So obviously this example doesn't WANT there to be an undef.

But if you wanted an undef and passed it, it wouldn't take it. 

So obviously we need ///=, the "only if it REALLY wasn't there"
operator. :-)

Or we could give special meaning to =.

Drat.

Good catch, though.

> 
> (See my remark about three paragraphs down.)
> 
> I'd like to raise my hand in the "please, God, no!" camp, for C< $=
> >.
> One of the things about Perl 5 that I dislike the most is all the $(
> $>
> $- $= $[ $$ special variables.  Yes, we're losing almost all of them
> - I
> think the only one that is really left is $! (*), which I can live
> with
> - but if we're going to introduce more of these, then perhaps we're
> not
> learning from our past mistakes as well as we think we are.

Or maybe we're making a valid, justified decision that facilitating
this kind of thing is desirable. 

Remember, signatures are getting an AWFUL lot of information crammed
into them. In fact, I wonder if your question wouldn't be better asked
about all the information we're putting into them:  Do we actually know
enough about what we're doing to justify all this?

So far there are (modulo my having confused the line noise):

sub versive(
    $invocant is topic: 
    $arg is rw, 
    @array is ro, 
    *@flattened_rest; 
    @optional_named_ones) 
is cached
{
    print "Don't let my rhyme \n"
        ~ "  raise your hackles -- \n"
        ~ "Learn perl6 instead, \n"
        ~ "  Cast off your shackles!\n\n";

    print " - OR - \n\n";

    print "When your data base \n"
        ~ "  is in a fix -- \n"
        ~ "Don't sweat the details, \n"
        ~ "  Learn Perl 6! \n";
        ~ "Burma Shave!\n";
}

And now we're trying to find out how to add one more item --
inherit-from-caller. 

It's really a neat idea, since it represents putting an entire idiom
into a single glyph -- essentially, surrounding every sub with 

if ($#_ == 0) { $_ := $CALLER::_; <REST OF SUB> }

Except that it's more than that, since you can do it for ANY part:

sub join($re, @*list = $=)   # Shouldn't that be @=? 

=Austin

Reply via email to