develooper Front page | perl.perl6.language | Postings from October 2001

Re: Perl 6 - Cheerleaders?

Thread Previous | Thread Next
From:
Damian Conway
Date:
October 29, 2001 17:27
Subject:
Re: Perl 6 - Cheerleaders?
Message ID:
200110300127.MAA23790@indy05.csse.monash.edu.au

   > > 	($obj1, $obj2)->foo(@args);
   > 
   > Is that merely sugar for:
   > 
   >     # errr, $_.foo(@args) ?
   >     $_->foo(@args) foreach($obj1, $obj2);

No. What you showed would be achieved with either a hyperoperation:

	($obj1, $obj2)^.foo(@args);

or a superposition:
	
	any($obj1, $obj2).foo(@args);


What I was proposing was that, since:

	method foo ( $me : $big, $boy ) {...}

can be called via either of:

	foo $obj: @args;
or: 
	$obj.foo(@args);

then, by analogy:

	method foo ( $me, $again : $big, $boy ) {...}

should be able to be called via either of:

	foo $obj1, $obj2 : @args;
or:
	($obj1, $obj2).foo(@args);


   > or is there something more interesting going on?

The latter. :-)


   > Maybe we need a method call hyperoperator.  I didn't just say that.

Since we already have a method call (non-hyper)operator, and since the
hyper-prefix will "hype" *any* operator, we already have a method
call hyperoperator:

	# method call		   # method hyper-call
        $obj.method(@args)   -->   @objlist^.method(@args)


   > > PS: I'd just like to point out that people gasped in horror when
   > >     I presented this idea at YAPC::NA::2001 as part of the
   > >     (soon-to-be-released) Klingon binding of Perl. ;-)
   > 
   > I'll add my own, now.

nuch SoH! bIQambogh DaqDaq qaHoH!

DamIan!

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About