On Fri, May 02, 2008 at 08:47:28AM -0500, John M. Dlugosz wrote: > In Perl 6, within a signature > > sub foo ( &f:(Int-->Int) ) > sub foo ( Continuous &f ) > > The latter says that &f is of type Continuous, not that the return type is > Continuous. That is what you want, right? The latter would be > sub bar ( &f:(Int -->Continuous) )
Hmm, that's not how I've been thinking of it. More like arrays and hashes, where sub foo ( Dog @dogpound ) specifies that @dogpound retuns Dogs, even though you have to call it with a subscript to do so. I think you'll have to stick with sub foo ( &f where Continous ) > A closure parameter block follows the block name. The normal annotation > type before the name works in the usual manner, typing the whole object. > It's not like the C++ syntax at all. If this is a proposal, I don't think it'll fly easily. Currently sub foo ( Feline &f ) is shorthand for sub foo ( &f:(-->Feline) ) Larry