Re: Compiled programs to keep BEGIN blocks?

2002-01-14 Thread Rafael Garcia-Suarez
On 2002.01.13 22:25 Michael G Schwern wrote: > Why would this: > > BEGIN { > push @INC, 'foo'; > } > > put 'foo' into @INC twice if it were compiled? The compiled program > should not be storing the post-BEGIN value of @INC, it should store > the original value at startup. The

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switchto make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Piers Cawley
Michael G Schwern <[EMAIL PROTECTED]> writes: > On Sun, Jan 13, 2002 at 10:04:58PM +0100, Mattia Barbon wrote: >> > $ bleadperl -MO=-qq,Deparse foo.plx >> > sub BEGIN { >> > print "foo\n"; >> > } >> > print "bar\n"; >> > >> > If B::Deparse can save BEGIN blocks, B::C can. >> >> I didn't mean

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switch to make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Mattia Barbon
> On Sun, Jan 13, 2002 at 10:04:58PM +0100, Mattia Barbon wrote: > > > $ bleadperl -MO=-qq,Deparse foo.plx > > > sub BEGIN { > > > print "foo\n"; > > > } > > > print "bar\n"; > > > > > > If B::Deparse can save BEGIN blocks, B::C can. > > > > I didn't mean that I can't write code to make B::C

Re: Compiled programs to keep BEGIN blocks?

2002-01-14 Thread Michael G Schwern
On Mon, Jan 14, 2002 at 11:13:27AM +0100, Rafael Garcia-Suarez wrote: > On 2002.01.13 22:25 Michael G Schwern wrote: > > Why would this: > > > > BEGIN { > > push @INC, 'foo'; > > } > > > > put 'foo' into @INC twice if it were compiled? The compiled program > > should not be stor

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switchto make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Piers Cawley
Michael G Schwern <[EMAIL PROTECTED]> writes: > On Mon, Jan 14, 2002 at 10:23:46AM +, Piers Cawley wrote: >> Um... You're wrong. If you do need 'startup time' initialization then >> you should do it in an INIT block. If I may quote from the >> documentation: > > Like it or not, people put lot

Re: Compiled programs to keep BEGIN blocks?

2002-01-14 Thread Rafael Garcia-Suarez
On 2002.01.14 17:29 Michael G Schwern wrote: > On Mon, Jan 14, 2002 at 11:13:27AM +0100, Rafael Garcia-Suarez wrote: > > On 2002.01.13 22:25 Michael G Schwern wrote: > > > Why would this: > > > > > > BEGIN { > > > push @INC, 'foo'; > > > } > > > > > > put 'foo' into @INC twice if

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switch to make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Michael G Schwern
On Mon, Jan 14, 2002 at 04:16:49PM +, Piers Cawley wrote: > > Like I said, if B::Deparse can do it, B::C can. > > But it shouldn't. How do you distinguish between: > >use Foo; > > (needs to use 'Foo' before generating the compiled script, otherwise > what's the bloody point?) > > and

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switch to make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Michael G Schwern
On Mon, Jan 14, 2002 at 04:16:49PM +, Piers Cawley wrote: > Michael G Schwern <[EMAIL PROTECTED]> writes: > > > On Mon, Jan 14, 2002 at 10:23:46AM +, Piers Cawley wrote: > >> Um... You're wrong. If you do need 'startup time' initialization then > >> you should do it in an INIT block. If I

Re: Compiled programs to keep BEGIN blocks?

2002-01-14 Thread Michael G Schwern
On Mon, Jan 14, 2002 at 06:45:05PM +0100, Rafael Garcia-Suarez wrote: > > # ~/tmp/Bar.pm > > package Bar; > > > > print "\@INC as Bar sees it\n"; > > print join "\n", @INC; > > Nah. You should wrap this code in a CHECK block : otherwise, in > your example, it will be run at BEGIN-time (i.e. when

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switch to make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Rafael Garcia-Suarez
On 2002.01.14 22:27 Michael G Schwern wrote: > B::Deparse has slowly gotten very good at figuring out BEGIN blocks > from 'use' statements and putting them in the right places. Hard > fought knowledge. Steal from it. There are still problems with pragmas. (As I was working on B::Deparse the las

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switchto make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Piers Cawley
Michael G Schwern <[EMAIL PROTECTED]> writes: > On Mon, Jan 14, 2002 at 04:16:49PM +, Piers Cawley wrote: >> Michael G Schwern <[EMAIL PROTECTED]> writes: >> >> > On Mon, Jan 14, 2002 at 10:23:46AM +, Piers Cawley wrote: >> >> Um... You're wrong. If you do need 'startup time' initializat

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switch to make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Michael G Schwern
On Mon, Jan 14, 2002 at 11:20:43PM +0100, Rafael Garcia-Suarez wrote: > On 2002.01.14 22:27 Michael G Schwern wrote: > > B::Deparse has slowly gotten very good at figuring out BEGIN blocks > > from 'use' statements and putting them in the right places. Hard > > fought knowledge. Steal from it. >

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switch to make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Michael G Schwern
On Mon, Jan 14, 2002 at 10:38:36PM +, Piers Cawley wrote: > >> Deferring BEGIN blocks 'til runtime will break rather more realworld > >> program than it fixes I think. > > > > Where is deferring involved? > > Err... it goes like this: > > by the main program> > > > > > > The compiled f

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switch to make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Michael G Schwern
On Mon, Jan 14, 2002 at 11:11:57PM +, Nicholas Clark wrote: > On Mon, Jan 14, 2002 at 10:38:36PM +, Piers Cawley wrote: > > Michael G Schwern <[EMAIL PROTECTED]> writes: > > > > > On Mon, Jan 14, 2002 at 04:16:49PM +, Piers Cawley wrote: > > >> Michael G Schwern <[EMAIL PROTECTED]> wr

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switchto make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Piers Cawley
Michael G Schwern <[EMAIL PROTECTED]> writes: > On Mon, Jan 14, 2002 at 10:38:36PM +, Piers Cawley wrote: >> >> Deferring BEGIN blocks 'til runtime will break rather more realworld >> >> program than it fixes I think. >> > >> > Where is deferring involved? >> >> Err... it goes like this: >>

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switchto make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Piers Cawley
Michael G Schwern <[EMAIL PROTECTED]> writes: > If there's Perl->C translation issue as to why that's not possible, > ok. But I know from a B standpoint all the information is there to > handle BEGIN blocks. No, it isn't. -- Piers "It is a truth universally acknowledged that a language in

Re: Compiled programs to keep BEGIN blocks? (was Re: [RFC] Switch to make Test::Builder output even if $^C ( for B::C ))

2002-01-14 Thread Michael G Schwern
On Mon, Jan 14, 2002 at 11:43:24PM +, Piers Cawley wrote: > > What's left? > > What about begin blocks with side effects. How do you propose > detecting the side effects. How do you deal with things that may > dispatch to different subroutines depending on when they are > evaluated? How do yo