Re: returning one or several values from a routine

2009-01-07 Thread Dave Whipp
Jon Lang wrote: I believe that we already have a signature creation operator, namely ":( @paramlist )". Yes, sorry, I missed that. > ... Regardless, the magic that makes this work would be the ability to assign a flat list of values to a signature. Is this wise? We already have the abilit

Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
Dave Whipp wrote: > Daniel Ruoso wrote: >> Hmm... I think that takes the discussion to another level, and the >> question is: >> >> "what does a capture returns when coerced to a context it doesn't >> provide a value for?" > > I'd like to take one step further, and ask what it is that introduced >

Re: returning one or several values from a routine

2009-01-06 Thread Dave Whipp
Daniel Ruoso wrote: Hmm... I think that takes the discussion to another level, and the question is: "what does a capture returns when coerced to a context it doesn't provide a value for?" I'd like to take one step further, and ask what it is that introduced capture semantics in the first pl

Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
TSa wrote: > Jon Lang wrote: >> item($x) # Dwimmey use of item context. > > IIRC this is the same as $$x, right? Or does that > extract the invocant slot without dwimmery? Umm... good question. This is a rather nasty paradox: on the one hand, we want to be able to stack $, @, and % with capture

Re: returning one or several values from a routine

2009-01-06 Thread TSa (Thomas Sandlaß)
On Tuesday, 6. January 2009 22:01:36 Jon Lang wrote: > item($x) # Dwimmey use of item context. IIRC this is the same as $$x, right? Or does that extract the invocant slot without dwimmery? > list($x) # Dwimmey use of list context. > hash($x) # Dwimmey use of hash context. > $x._ # the Cap

Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
Daniel Ruoso wrote: > Hmm... I think that takes the discussion to another level, and the > question is: > > "what does a capture returns when coerced to a context it doesn't > provide a value for?" > > The easy answer would be undef, empty array and empty hash, but that > doesn't DWIM at all. > >

Re: returning one or several values from a routine

2009-01-06 Thread Daniel Ruoso
Em Ter, 2009-01-06 às 11:28 -0800, Jon Lang escreveu: > Of course, that's only a third of the problem. What should people > expect with each of these: Hmm... I think that takes the discussion to another level, and the question is: "what does a capture returns when coerced to a context it doesn'

Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
Daniel Ruoso wrote: > I've just realized we were missing some spots, so remaking the list of > possibilities > > my $a = sub s1 { return a => 1 } > my $b = sub s2 { return a => 1, b => 2 } > my $c = sub s3 { return 1, 2, 3, a => 1, b => 2 } > my $d = sub s4 { return 1 } > my $e = sub s5 { retu

Re: returning one or several values from a routine

2009-01-06 Thread Daniel Ruoso
Em Seg, 2009-01-05 às 20:32 +0100, Moritz Lenz escreveu: > Daniel Ruoso wrote: > > would force item context in the capture, and here is the problem, as a > > capture in item context was supposed to return the invocant. > Maybe we could have a different rule for captures in scalar contexts > that do

Re: returning one or several values from a routine

2009-01-05 Thread Jon Lang
Daniel Ruoso wrote: > > Hi, > > As smop and mildew now support ControlExceptionReturn (see > v6/mildew/t/return_function.t), an important question raised: > > sub plural { return 1,2 } > sub singular { return 1 } > my @a = plural(); > my $b = plural(); > my @c = singular(); > my $d = singular

Re: returning one or several values from a routine

2009-01-05 Thread Moritz Lenz
Daniel Ruoso wrote: > Hi, > > As smop and mildew now support ControlExceptionReturn (see > v6/mildew/t/return_function.t), an important question raised: > > sub plural { return 1,2 } > sub singular { return 1 } > my @a = plural(); > my $b = plural(); > my @c = singular(); > my $d = singular

returning one or several values from a routine

2008-12-27 Thread Daniel Ruoso
Hi, As smop and mildew now support ControlExceptionReturn (see v6/mildew/t/return_function.t), an important question raised: sub plural { return 1,2 } sub singular { return 1 } my @a = plural(); my $b = plural(); my @c = singular(); my $d = singular(); What should @a, $b, @c and $d contain