Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Bart Lateur
On Tue, 6 Feb 2001 04:36:36 +1100 (EST), Damian Conway wrote: >RFC 271 handles this. Your example would be: > >sub readit { >open F, "< $f" ... >scalar() >} >post readit { >close F; >} The connection between these two things is

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Johan Vromans
Bart Lateur <[EMAIL PROTECTED]> writes: > The place where it would be put, would be irrelevant. > > sub readit { > POST { > close F; > } > open F, "< $f" ... > scalar() > } Would the POST be executed if the open fails? Wh

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread John Porter
Johan Vromans wrote: > > Would the POST be executed if the open fails? Why? Why not? Of course. It's a post-handler on the sub. > All that POST and such do, is obfuscate the flow of control. No more so than contine{} on a loop, or END{} in a file, or DESTROY{} in a class. -- John Porter

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread John Porter
Tony Olekshy wrote: > > I think "always" should be part of an explicit statement, such > as "try", not some implied property of block structure introduced > by a dangling clause (inside or outside). Why? For that matter, why must "try" itself be explicit? It says, "I'm probly gonna put some e

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Ariel Scolnicov
Johan Vromans <[EMAIL PROTECTED]> writes: [...] > But I think this is getting ridiculous. $slightly_joking++; I'd > propose a much nicer and cleaner concept: > > sub readit { > open F ... ; > prog1 { > scalar(); > close F; > } > } > > 'prog1' e

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Glenn Linderman
Tony Olekshy wrote: > I think "always" should be part of an explicit statement, such > as "try", not some implied property of block structure introduced > by a dangling clause (inside or outside). Funny, during the perl6 RFC period, during the discussion of the exception handling RFCs 88 and 119

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Peter Scott
At 09:59 AM 2/7/01 -0500, John Porter wrote: >Tony Olekshy wrote: > > > > I think "always" should be part of an explicit statement, such > > as "try", not some implied property of block structure introduced > > by a dangling clause (inside or outside). > >Why? For that matter, why must "try" itse

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread John Porter
Peter Scott wrote: > > I want the 'try' there for my sake, not Perl's; ... it > helps alert me that the following block is subject to non-local control > flow rules. Huh? Down that road lies the Java madness. eval { foo(); }; sub foo { b

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Peter Scott
At 02:17 PM 2/7/01 -0500, John Porter wrote: >Peter Scott wrote: > > > > I want the 'try' there for my sake, not Perl's; ... it > > helps alert me that the following block is subject to non-local control > > flow rules. > >Huh? Down that road lies the Java madness. > > eval { >

Re: assign to magic name-of-function variable instead of"return"

2001-02-07 Thread David L. Nicol
> Sorry, I wasn't clear. Let me rephrase. The 'try' helps me determine that > the following block is going to be subject to exception handlers which will > immediately follow as siblings of the block. Somewhat as I would look at > an if...elsif...else construct, it helps me put the block in c

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread John Porter
Peter Scott wrote: > Sorry, I wasn't clear. Let me rephrase. The 'try' helps me determine that > the following block is going to be subject to exception handlers which will > immediately follow as siblings of the block. O.k. That makes sense if some blocks can be try blocks (by adding the

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread David L. Nicol
John Porter wrote: > Note that END{} and BEGIN{} require no formal introduction. > You can put them anywhere you want, and they run at the proper time. > > Even continue{} is an implicit goto. And it requires no introduction > either. So if a post{} block could appear anywhere inside a block,

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Peter Scott
At 05:07 PM 2/7/01 -0500, John Porter wrote: >Peter Scott wrote: > > Sorry, I wasn't clear. Let me rephrase. The 'try' helps me determine > that > > the following block is going to be subject to exception handlers which > will > > immediately follow as siblings of the block. > >O.k. That make

Re: assign to magic name-of-function variable instead of "return"

2001-02-07 Thread Nicholas Clark
On Wed, Feb 07, 2001 at 04:30:24PM -0600, David L. Nicol wrote: > sub has_post_blocks{ > my $i = 3; > post { print "i ended up as $i"}; > my $arg1 = shift; $arg1 > 4 or die "arg1 ($arg1) too small"; > my $j = 2; > post {

POST blocks (like END, but in a sub or sub-like scope)

2001-02-07 Thread David L. Nicol
Nicholas Clark wrote: > > On Wed, Feb 07, 2001 at 04:30:24PM -0600, David L. Nicol wrote: > > > sub has_post_blocks{ > > my $i = 3; > > post { print "i ended up as $i"}; > > my $arg1 = shift; $arg1 > 4 or die "arg1 ($arg1) too small"; > >

Re: POST blocks (like END, but in a sub or sub-like scope)

2001-02-07 Thread Nicholas Clark
On Wed, Feb 07, 2001 at 05:15:41PM -0600, David L. Nicol wrote: > Nicholas Clark wrote: > > > > On Wed, Feb 07, 2001 at 04:30:24PM -0600, David L. Nicol wrote: > > > > > sub has_post_blocks{ > > > my $i = 3; > > > post { print "i ended up as $i"}; > > >

Re: POST blocks (like END, but in a sub or sub-like scope)

2001-02-07 Thread David L. Nicol
Nicholas Clark wrote: > on the other hand, I'll argue the other side that > > { > my $flag > open FOO, " ... > } > post { > close FOO if $flag; > } > > is clearer because the tidy up doesn't visually get in the way of the flow > of what you're doing, and you can see what $flag is meant