On Fri, Apr 11, 2008 at 03:26:02AM -0000, John M. Dlugosz wrote:
: S06 shows how to define named-only parameters, "marked with a prefix :".  But 
no example shows anything more than a bare parameter name.  No type is ever 
given!
: 
: Looking through my copy of STD.pm, I'm baffled, as it seems not to take types 
in parameter lists at all.

It's at the top of token parameter where there is a <type_constraint>*.

: So, is it
:   method bytes ( Encoding :$encoding ) returns Int
: 
: or 
: 
:   method bytes ( : Encoding $encoding ) returns Int
: 
: ?
: 
: I'm guessing that the latter would be confused with use of : after the 
invocant, and it follows that
: 
:   method bytes (Encoding :encoding($override_encoding)) returns Int
: 
: would work.

Indeed.

Larry

Reply via email to