develooper Front page | perl.perl5.porters | Postings from January 2001

Re: Too late to run CHECK block.

Thread Previous | Thread Next
From:
Piers Cawley
Date:
January 29, 2001 08:25
Subject:
Re: Too late to run CHECK block.
Message ID:
m3wvbeqq73.fsf@iest.bofh.org.uk
Gurusamy Sarathy <gsar@ActiveState.com> writes:

> On 29 Jan 2001 11:26:37 GMT, Piers Cawley wrote:
> >So, I'm trying to write some code which ensures at compile time that,
> >if a class claims to implement a given interface, then all the methods
> >of said interface are actually implemented.
> >
> >So, in the 'implements' module I have a CHECK block that checks that
> >all the methods requested by the interface are accessible. No problem.
> >
> >Until, one of my class's client classes comes to do a deferred load
> >using require and everything falls over in a heap because it's 
> >
> >    Too late to run CHECK block.
> 
> This is just a warning.  i.e., you can suppress it with C<no
> warnings>.

Oh, duh!

> >And I can't, for the life of me, understand why. Surely there's still
> >a seperation between the compilation of the required module and any
> >runtime behaviour, so there should be room to run the appropriate
> >CHECK and INIT blocks.
> >
> >And if there isn't, is there any way of working out within my
> >'implements' module that it's going to be too late to run a CHECK
> >block? 
> 
> In the current implementation, there is exactly one point at which
> CHECK and INIT blocks are run (this being the point at which the
> Compiler would do its work, when it saves and restores program
> state, respectively).
> 
> But I believe Larry has stated that CHECK blocks should be able to
> run at the end of compilation of every individual "compilation unit",
> whatever that happens to be (file/BEGIN block/eval"").  Will those
> semantics be useful for you?

That would definitely be handy to have. It's certainly the behaviour I
expected.

-- 
Piers


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About