Re: [perl #61126] return should apply to the lexically enclosing routine, map is no exception

2008-12-08 Thread Carl Mäsak
Daniel (), Carl (): The above reasoning raises the following question for me: how do I return from a sub or a method from within a map block? I suppose what you want can be achieved with last, it probably should work in map as well, since map and for are synonims... That is all good and well

Re: [perl #61126] return should apply to the lexically enclosing routine, map is no exception

2008-12-08 Thread Daniel Ruoso
Em Dom, 2008-12-07 às 18:10 +0100, Carl Mäsak escreveu: The above reasoning raises the following question for me: how do I return from a sub or a method from within a map block? I suppose what you want can be achieved with last, it probably should work in map as well, since map and for are

Re: [perl #61126] return should apply to the lexically enclosing routine, map is no exception

2008-12-08 Thread Daniel Ruoso
Em Seg, 2008-12-08 às 12:08 +0100, Carl Mäsak escreveu: Daniel (), Carl (): That is all good and well for exiting the map itself; but what I want to achieve is to exit the surrounding sub or method block. Example: Er... I mean actually the opposite... it should always return from the

Re: [perl #61126] return should apply to the lexically enclosing routine, map is no exception

2008-12-08 Thread Carl Mäsak
Daniel (), Carl (): That is all good and well for exiting the map itself; but what I want to achieve is to exit the surrounding sub or method block. Example: Er... I mean actually the opposite... it should always return from the surrounding sub or method, never only from map, if you want to

Re: [perl #61126] return should apply to the lexically enclosing routine, map is no exception

2008-12-07 Thread Carl Mäsak
Daniel, in rakudobug ticket [perl #61126] (): The following two snippets of code are supposed to behave the same: sub bar($code) { $code() }; sub foo { bar { return 1 }; return 2; }; say foo; and sub foo { map { return 1 }, 1; return 2 }; say foo; both are supposed to return 1. For