On Thu, 17 Aug 2000, Jonathan Scott Duff wrote:

> BTW, if we define C<with> to map keys of a hash to named place holders
> in a curried expression, this might be a good thing:
> 
>       with %person {
>           print "Howdy, ", ^firstname, " ", ^lastname;
>       }
> 
>       # becomes
>       sub {
>           print "Howdy, ", $person{$_[0]}, " ", $person{$_[1]};
>       }->('firstname', 'lastname');
> 
>       # becomes
>       print "Howdy, ", $person{'firstname'}, " ", $person{'lastname'};
> 
> (If that's what people meant, I didn't see anyone actually say it).


        Well, so far, I like this best of everything that's been proposed
for how "with" will work.  I am still passionately against the keyword
"with", since (IMHO) it conveys no sense of what it does.  I think any
of the following keywords would be better:
                express, alias, in, within 

        The following words could also be overloaded for this purpose:
                map, use

        In any case, if I'm tracking correctly, all of the following
should be legit using the new syntax (forgive me for trying a new keyword):

        within %person {
                &calc_letter_grade(^name, \^letter_grade);
                print "^first_name is ^age\n"; 
                print "^{first_name}'s numerical grade is ^num_grade\n"; 
                ^num_grade = 0 unless ^never_missed_class;
                if ( ^num_grade > 60 ) { print "^name passed!\n"; }
                @temp = (^name, ^age);
        };


        This would translate to the following: 
                &calc_letter_grade($person{name}, \$person{letter_grade});
                print "$person{first_name} is $person{age}\n"; 
                print "$person{first_name}'s numerical grade is
$person{num_grade}\n"; 
                $person{num_grade} = 0 unless $person{never_missed_class};
                if ( $person{num_grade} > 60 ) { print "$person{name}
passed!\n"; }
                @temp = ($person{name}, $person{age});


                                Dave

Reply via email to