Too late for INIT

2005-09-23 Thread hv
If I correctly read this message from Larry:
  http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-04/msg00081.html
we shouldn't be refusing to run INIT blocks just because a module was
loaded with 'require', or because a string was eval()ed.

That was the most recent discussion of the issue I could find: have
I missed a later refutation? If not, is this still desirable?

The current behaviour seems like an odd wart that substantially
limits the usefulness of INIT blocks. I'm not sure whether an
analogous fix is required for CHECK blocks, or what the impact of
either change might be.

Hugo


Re: Too late for INIT

2005-09-23 Thread Rafael Garcia-Suarez
[EMAIL PROTECTED] wrote:
 If I correctly read this message from Larry:
   http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-04/msg00081.html
 we shouldn't be refusing to run INIT blocks just because a module was
 loaded with 'require', or because a string was eval()ed.
 
 That was the most recent discussion of the issue I could find: have
 I missed a later refutation? If not, is this still desirable?
 
 The current behaviour seems like an odd wart that substantially
 limits the usefulness of INIT blocks. I'm not sure whether an
 analogous fix is required for CHECK blocks, or what the impact of
 either change might be.

The CHECK blocks behaviour cannot be changed for compatibility
reasons (and because O.pm relies on them.) That is, they're run
at the end of the compilation of the main compilation unit, and
that's all.

The INIT blocks are strictly symmetrical to the CHECK blocks.
I'm not sure if anything currently relies on the not-so-intuitive
behaviour of init blocks.

I used to add this in perltodo :

  =head2 UNITCHECK

  Introduce a new special block, UNITCHECK, which is run at the end of a
  compilation unit (module, file, eval(STRING) block). This will correspond to
  the Perl 6 CHECK. Perl 5's CHECK cannot be changed or removed because the
  O.pm/B.pm backend framework depends on it.

That's not exactly the same thing as Larry's proposal on the mail you
linked to.

-- 
A system is nothing more than the subordination of all aspects of the universe
to any one such aspect.
-- Borges