On Mon, Jul 04, 2005 at 07:01:00PM +0200, "TSa (Thomas Sandlaß)" wrote:
: Larry Wall wrote:
: >On Wed, Jun 08, 2005 at 12:37:22PM +0200, "TSa (Thomas Sandlaß)" wrote:
: >: BTW, is -> on the 'symbolic unary' precedence level
: >: as its read-only companion \ ?.
: >
: >No, -> introduces a term that h
Larry Wall wrote:
On Wed, Jun 08, 2005 at 12:37:22PM +0200, "TSa (Thomas Sandlaß)" wrote:
: BTW, is -> on the 'symbolic unary' precedence level
: as its read-only companion \ ?.
No, -> introduces a term that happens to consist of a formal signature
and a block. There are no ordinary expressions
Larry Wall <[EMAIL PROTECTED]> writes:
> On Wed, Jun 08, 2005 at 10:51:34PM +, Luke Palmer wrote:
> : Yeah, that's pretty. But that will bite people who don't understand
> : continuations; it will bite people who don't understand "return"; it
> : will even bite people who understand continuat
Luke Palmer <[EMAIL PROTECTED]> writes:
> On 6/8/05, Piers Cawley <[EMAIL PROTECTED]> wrote:
>> > In other words, it outputs:
>> >
>> >Foo
>> >Foo
>> ># dies
>
> Yep. My mistake.
>
>> If that works, then I think it means we can write:
>>
>> sub call-with-current-continuation(Code
On Wed, Jun 08, 2005 at 10:51:34PM +, Luke Palmer wrote:
: Yeah, that's pretty. But that will bite people who don't understand
: continuations; it will bite people who don't understand "return"; it
: will even bite people who understand continuations, because they can
: be made in such an awkw
On 6/8/05, Piers Cawley <[EMAIL PROTECTED]> wrote:
> > In other words, it outputs:
> >
> >Foo
> >Foo
> ># dies
Yep. My mistake.
> If that works, then I think it means we can write:
>
> sub call-with-current-continuation(Code $code) {
> my $cc = -> $retval { return $retva
"TSa (Thomas Sandlaß)" <[EMAIL PROTECTED]> writes:
> Piers Cawley wrote:
>> [..] then I think it means we can write:
>> sub call-with-current-continuation(Code $code) {
>> my $cc = -> $retval { return $retval }
>
> For the records: the return here is the essential ingredient, right?
>
On Wed, Jun 08, 2005 at 12:37:22PM +0200, "TSa (Thomas Sandlaß)" wrote:
: BTW, is -> on the 'symbolic unary' precedence level
: as its read-only companion \ ?.
No, -> introduces a term that happens to consist of a formal signature
and a block. There are no ordinary expressions involved until you
Piers Cawley wrote:
[..] then I think it means we can write:
sub call-with-current-continuation(Code $code) {
my $cc = -> $retval { return $retval }
For the records: the return here is the essential ingredient, right?
Without it the block would be evaluated or optimized away to an
Piers Cawley wrote:
"TSa (Thomas Sandlaß)" <[EMAIL PROTECTED]> writes:
Piers Cawley wrote:
My preference is for:
Boo
Boo
Can't dereferene literal numeric literal 42 as a coderef.
How do you reach the second 'Boo'? Iff -> does not create a Sub
but a Block instance then Luke's code
Piers Cawley <[EMAIL PROTECTED]> writes:
> "TSa (Thomas Sandlaß)" <[EMAIL PROTECTED]> writes:
>
>> Piers Cawley wrote:
>>> My preference is for:
>>> Boo
>>> Boo
>>> Can't dereferene literal numeric literal 42 as a coderef.
>>
>> How do you reach the second 'Boo'? Iff -> does not create
"TSa (Thomas Sandlaß)" <[EMAIL PROTECTED]> writes:
> Piers Cawley wrote:
>> My preference is for:
>> Boo
>> Boo
>> Can't dereferene literal numeric literal 42 as a coderef.
>
> How do you reach the second 'Boo'? Iff -> does not create a Sub
> but a Block instance then Luke's code can b
Piers Cawley wrote:
My preference is for:
Boo
Boo
Can't dereferene literal numeric literal 42 as a coderef.
How do you reach the second 'Boo'? Iff -> does not create a Sub
but a Block instance then Luke's code can be interpreted as a
much smarter version of
sub foo()
{
Well,
does using -> as blockref creator also give anonymous scalars?
$y = -> $x { $x = 3; $x }; # $y:(Ref of Block of Int)
BTW, is -> on the 'symbolic unary' precedence level
as its read-only companion \ ?. Are they pure macros?
--
TSa (Thomas Sandlaß)
Luke Palmer <[EMAIL PROTECTED]> writes:
> On 6/7/05, Matt Fowles <[EMAIL PROTECTED]> wrote:
>> On 6/7/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote:
>> > Hi,
>> >
>> > sub foo (Code $code) {
>> > my $return_to_caller = -> $ret { return $ret };
>> >
>> > $code($return_to_caller);
>> >
Luke Palmer wrote:
Says not:
Boo
Boo
Boo
...
This is clear, but I would expect the output
Boo
42
because the return value of foo is a ref to a block that
makes the caller return 42. This is written in my current
Perl6 as
&foo:( : --> Block --> 42)
The question is when exa
All~
On 6/7/05, Luke Palmer <[EMAIL PROTECTED]> wrote:
> On 6/7/05, Matt Fowles <[EMAIL PROTECTED]> wrote:
> > On 6/7/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > sub foo (Code $code) {
> > > my $return_to_caller = -> $ret { return $ret };
> > >
> > > $code($ret
On 6/7/05, Luke Palmer <[EMAIL PROTECTED]> wrote:
> Then let's put it this way:
>
>sub foo () {
>for 0..10 {
>when 6 { return 42 }
>}
>return 26;
>}
>
> And if that didn't do it, then let's write it equivalently as:
>
>sub foo () {
>&map(->
On 6/7/05, Matt Fowles <[EMAIL PROTECTED]> wrote:
> On 6/7/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > sub foo (Code $code) {
> > my $return_to_caller = -> $ret { return $ret };
> >
> > $code($return_to_caller);
> > return 23;
> > }
> >
> > sub bar (Code $retu
Hi,
Matt Fowles wrote:
> On 6/7/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote:
>> sub foo (Code $code) {
>> my $return_to_caller = -> $ret { return $ret };
>>
>> $code($return_to_caller);
>> return 23;
>> }
>>
>> sub bar (Code $return) { $return(42) }
>>
>> say foo &bar; #
Ingo Blechschmidt <[EMAIL PROTECTED]> writes:
> Hi,
>
> sub foo (Code $code) {
> my $return_to_caller = -> $ret { return $ret };
>
> $code($return_to_caller);
> return 23;
> }
>
> sub bar (Code $return) { $return(42) }
>
> say foo &bar; # 42 or 23?
>
> I think
Ingo~
On 6/7/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote:
> Hi,
>
> sub foo (Code $code) {
> my $return_to_caller = -> $ret { return $ret };
>
> $code($return_to_caller);
> return 23;
> }
>
> sub bar (Code $return) { $return(42) }
>
> say foo &bar; # 42 or 23?
>
> I th
22 matches
Mail list logo