Comma in (sub) traits?

2005-03-07 Thread wolverian
Hello all, while writing some experimental code with Pugs, I realised that it is a bit hard for me to parse the following type of declaration: sub greeting (Str $person) returns Str is export { "Hello, $person" } Specifically, the 'is export' trait is too buried. Reformatting it

Re: Comma in (sub) traits?

2005-03-07 Thread Thomas Sandlaß
wolverian wrote: There are other ways to format the declaration, like indenting the traits line: Yes, I like: sub greeting( Str $person ) returns Str is export { "Hello, $person" } With the sub-line as some kind of intro and the block as the terminator. A l

Re: Comma in (sub) traits?

2005-03-07 Thread Aldo Calpini
wolverian wrote: Hello all, while writing some experimental code with Pugs, I realised that it is a bit hard for me to parse the following type of declaration: sub greeting (Str $person) returns Str is export { "Hello, $person" } don't know if it helps, but I guess that you can also

Re: Comma in (sub) traits?

2005-03-07 Thread David Storrs
On Mon, Mar 07, 2005 at 03:43:19PM +0100, Aldo Calpini wrote: > don't know if it helps, but I guess that you can also write it like > this, if you prefer: > > sub greeting(Str $person) { > returns Str; > is export; > "Hello, $person"; > } > > (this guess is based

Re: Comma in (sub) traits?

2005-03-07 Thread Larry Wall
On Mon, Mar 07, 2005 at 12:55:49PM +0200, wolverian wrote: : Hello all, : : while writing some experimental code with Pugs, I realised that it is a : bit hard for me to parse the following type of declaration: : : sub greeting (Str $person) returns Str is export { : "Hello, $person" :

Re: Comma in (sub) traits?

2005-03-07 Thread Larry Wall
On Mon, Mar 07, 2005 at 08:27:10AM -0800, David Storrs wrote: : On Mon, Mar 07, 2005 at 03:43:19PM +0100, Aldo Calpini wrote: : : > don't know if it helps, but I guess that you can also write it like : > this, if you prefer: : > : > sub greeting(Str $person) { : > returns Str; : >

Re: Comma in (sub) traits?

2005-03-07 Thread Thomas Sandlaß
Larry Wall wrote: Yes, and it wouldn't work at all if you ever wanted to autoload anything. If we ever get to where we're autoloading class bodies, they'd have the same problem with embedded declarations. The compiler can't work with information that isn't there. This is something that is blurry t

Re: Comma in (sub) traits?

2005-03-07 Thread Juerd
Larry Wall skribis 2005-03-07 8:40 (-0800): > method foo ($self: $odd returns Int where { $_ % 1 }, $even > return Int where { not $_ % 1 }, Block ?&permutator, [EMAIL PROTECTED]) > returns Footype is good is bad is ugly { ... } That someone took the time to bring this up pleases me.

Re: Comma in (sub) traits?

2005-03-07 Thread Larry Wall
On Mon, Mar 07, 2005 at 05:53:23PM +0100, Thomas Sandlaß wrote: : Larry Wall wrote: : >Yes, and it wouldn't work at all if you ever wanted to autoload anything. : >If we ever get to where we're autoloading class bodies, they'd have the : >same problem with embedded declarations. The compiler can't

Re: Comma in (sub) traits?

2005-03-09 Thread wolverian
On Mon, Mar 07, 2005 at 08:40:19AM -0800, Larry Wall wrote: > Here are some alternatives you don't seem to have considered: [...] > my Str sub greeting (Str $person) is export { > "Hello, $person"; > } > > my Str > sub greeting (Str $person) is export { > "Hello,

Re: Comma in (sub) traits?

2005-03-09 Thread Larry Wall
On Wed, Mar 09, 2005 at 02:15:56PM +0200, wolverian wrote: : On Mon, Mar 07, 2005 at 08:40:19AM -0800, Larry Wall wrote: : > Here are some alternatives you don't seem to have considered: : : [...] : : > my Str sub greeting (Str $person) is export { : > "Hello, $person"; : > } : >

Re: Comma in (sub) traits?

2005-03-09 Thread Larry Wall
On Wed, Mar 09, 2005 at 09:13:27AM -0800, Larry Wall wrote: : sub foo ( Int $bar where { $_ == 0 } ){ ... } Well, I'm not sure about that syntax. It might have to be either sub foo ( Int where { $_ == 0 } $bar ){ ... } or sub foo ( $bar of Int where { $_ == 0 } $bar ){