On Mon, Jun 13, 2005 at 10:48:47AM -0700, chromatic wrote:
> > # Problem;
> > my $fh = BEGIN { open "some_file" err... };
> > # Compile-time filehandle leaked into runtime!
> > say =$fh;
>
> Perhaps I'm being very naive, but why is this a problem? Maybe it's not
> the best way to do something, but I can see it being useful in some
> circumstances.
Er. The BEGIN{} time thing is a FileHandle.
When compilation finishes, this program is saved as a .ast, or a .pbc,
or a .hs, or a .c file.
On runtime, $fh is supposed to contain a immutable constant value,
much as like if we had said:
my $compile_time = BEGIN { time() };
Except it involves external resources.
Thanks,
/Autrijus/
pgpSmv83aW1mT.pgp
Description: PGP signature
