On Sunday 07 July 2002 04:10 pm, Ashley Winters wrote:
>
> given my Doberman $sis is female = .dog[0] but pregnant -> $mother {
>     for my Doberman @puppies = new Doberman x $mother.littersize

In hindsight, I probably meant
    for my Doberman @puppies = ^new Doberman x $mother.littersize

It's hard to come up with working code when there's no compiler for it.
Then again, that just makes it harder for people to disagree with you.

As for the 'bad' semantics of C<my($foo, $bar) = ^new Stuff>, can I borrow 
C<for> with no iterator for that? After all, C<given> with no argument 
already does what C<for> with no iterator would otherwise do. I think.

my($foo, $bar) = for { $_ = new Stuff }

It could also work in subs...

my($foo, $bar) = read_lines($*STDIN);

sub read_lines ($it) {
    for { $_ = <$it> // last }   # last unshifts $_ from the wanted list
    return;    # any return-value is after the final for{} value read
}

Well, I can wait for whatever apocalypse is going to specify how to return the 
'wanted' number of values. I'm just spinning my wheels. :)

Ashley Winters

Reply via email to