Re: syntax question on parameter lists

2008-04-10 Thread Larry Wall
On Thu, Apr 10, 2008 at 11:36:09PM -0500, Patrick R. Michaud wrote:
: Yes, but where does  resolve down to a typename?
: My reading of STD.pm is that  becomes a  
: (since it's not a 'where' clause in this case), and  is currently
: one of , , or .

Value is supposed to include fulltypename, but I have it commented out
at the moment due to the fact that my current longest-token matcher
can't backtrack to an alternate choice.  That is a temporary condition,
hopefully.

Larry


Re: syntax question on parameter lists

2008-04-10 Thread Patrick R. Michaud
On Thu, Apr 10, 2008 at 09:18:38PM -0700, Larry Wall wrote:
> On Fri, Apr 11, 2008 at 03:26:02AM -, 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 *.

Yes, but where does  resolve down to a typename?
My reading of STD.pm is that  becomes a  
(since it's not a 'where' clause in this case), and  is currently
one of , , or .

Pm


Re: syntax question on parameter lists

2008-04-10 Thread Larry Wall
On Fri, Apr 11, 2008 at 03:26:02AM -, 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 *.

: 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


syntax question on parameter lists

2008-04-10 Thread John M. Dlugosz
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.

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.