Sane (less insane) pair semantics

2005-10-09 Thread Ingo Blechschmidt
Hi, while fixing bugs for the imminent Pugs 6.2.10 release, we ran into several issues with magical pairs (pairs which unexpectedly participate in named binding) again. Based on Luke's Demagicalizing pairs thread [1], #perl6 refined the exact semantics [2]. The proposed changes are: * (key =

Re: Sane (less insane) pair semantics

2005-10-09 Thread Uri Guttman
IB == Ingo Blechschmidt [EMAIL PROTECTED] writes: IB * (key = $value) (with the parens) is always a positionally passed IB Pair object. key = $value (without the parens) is a named IB parameter: IB sub foo ($a) {...} IB * Unary * makes a normal pair variable participate in

Re: Sane (less insane) pair semantics

2005-10-09 Thread Ingo Blechschmidt
Hi, Uri Guttman wrote: IB == Ingo Blechschmidt [EMAIL PROTECTED] writes: IB * (key = $value) (with the parens) is always a positionally passed IB Pair object. key = $value (without the parens) is a named IB parameter: IB sub foo ($a) {...} IB * Unary * makes a

Re: Sane (less insane) pair semantics

2005-10-09 Thread Yuval Kogman
On Sun, Oct 09, 2005 at 20:22:59 +0200, Ingo Blechschmidt wrote: Opinions? Yes! -- () Yuval Kogman [EMAIL PROTECTED] 0xEBD27418 perl hacker /\ kung foo master: *shu*rik*en*sh*u*rik*en*s*hur*i*ke*n*: neeyah pgpPtAVtx26AP.pgp Description: PGP signature

Re: Sane (less insane) pair semantics

2005-10-09 Thread Luke Palmer
On 10/9/05, Uri Guttman [EMAIL PROTECTED] wrote: IB == Ingo Blechschmidt [EMAIL PROTECTED] writes: IB sub foo ($a) {...} works for me. but what about lists and arrays? my @z = ( 'a', 1 ) ; foo( @z ) # $a = [ 'a', 1 ] ?? Yep. my @z = ( a = 1 ) ;

Re: Sane (less insane) pair semantics

2005-10-09 Thread Uri Guttman
LP == Luke Palmer [EMAIL PROTECTED] writes: LP On 10/9/05, Uri Guttman [EMAIL PROTECTED] wrote: IB == Ingo Blechschmidt [EMAIL PROTECTED] writes: IB sub foo ($a) {...} works for me. but what about lists and arrays? my @z = ( 'a', 1 ) ; foo( @z ) # $a = [ 'a', 1 ]

Re: Sane (less insane) pair semantics

2005-10-09 Thread Stuart Cook
The think I don't like about `foo( *$bar )` is that it's not clear whether you're splatting a pair, or a hash, or an array, or a complete argument-list object. This is probably fine for quick-'n'-dirty code, but I'd like to encourage a more explicit style: my %hash = (a='b', c='d'); foo(

Re: Type annotations

2005-10-09 Thread Stuart Cook
The more I think about it, the more I'm convinced that perl6 (by default) shouldn't refuse to run programs because of a (perceived or real) type error. It should, of course, emit a compile-type type *warning*, which can be silenced or made fatal at the user's discretion. There are a few reasons

Re: Sane (less insane) pair semantics

2005-10-09 Thread Austin Hastings
Ingo Blechschmidt wrote: Hi, while fixing bugs for the imminent Pugs 6.2.10 release, we ran into several issues with magical pairs (pairs which unexpectedly participate in named binding) again. Based on Luke's Demagicalizing pairs thread [1], #perl6 refined the exact semantics [2]. The proposed

Re: Sane (less insane) pair semantics

2005-10-09 Thread Stuart Cook
On 10/10/05, Austin Hastings [EMAIL PROTECTED] wrote: What about whitespace? foo (a = 42); # Note space Is that the first case (subcall with named arg) or the second case (sub with positional pair)? Sub with positional pair, since the parens aren't call-parens (because of the space), so

Re: Sane (less insane) pair semantics

2005-10-09 Thread Uri Guttman
SC == Stuart Cook [EMAIL PROTECTED] writes: SC The think I don't like about `foo( *$bar )` is that it's not clear SC whether you're splatting a pair, or a hash, or an array, or a complete SC argument-list object. This is probably fine for quick-'n'-dirty code, SC but I'd like to

Re: Sane (less insane) pair semantics

2005-10-09 Thread Austin Hastings
Stuart Cook wrote: On 10/10/05, Austin Hastings [EMAIL PROTECTED] wrote: What about whitespace? foo (a = 42); # Note space Is that the first case (subcall with named arg) or the second case (sub with positional pair)? Sub with positional pair, since the parens aren't call-parens