develooper Front page | perl.perl6.language | Postings from August 2005

Re: BEGIN {...} and IO

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
August 13, 2005 08:27
Subject:
Re: BEGIN {...} and IO
Message ID:
20050813152743.GA15373@plum.flirble.org
On Tue, Jun 14, 2005 at 07:56:32PM +0200, Ingo Blechschmidt wrote:
> Maybe we should just hardcode the filehandles-leaking-into-runtime case
> in the compiler? And, if the compiler can't detect the problem at
> compile-time, just throw a runtime exception?
> 
>     my $fh = BEGIN { open "some_file" };
>     =$fh;  # "Can't readline() on unopened filehandle leaked
>            # from compile-time into runtime, try to..."
> 
> Opinions?

Aren't filehandles just part of a more general case of the compiler
serialising something out to the bytecode on disk that can't actually be
serialised? So the attempt at serialisation of a file handle, directory
handle, database handle, shared memory handle or any other external resource
should fail? (Unless that resource class has a viable serialise/deserialise
system)

Nicholas Clark

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