Re: BEGIN {...} and IO

2005-08-14 Thread Yuval Kogman
On Sat, Aug 13, 2005 at 19:08:09 +0200, Ingo Blechschmidt wrote: > BTW, is it even necessary to support user-defined serializing > behaviours? (After all, an Item can only be an Int, Num, Str, Ref, Bit, > Pair, Junc, Type, Code, Undef, and Object in PIL2 [1].) Yes, because data types may implici

Re: BEGIN {...} and IO

2005-08-13 Thread Ingo Blechschmidt
Hi, Nicholas Clark wrote: > 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? >> >>

Re: BEGIN {...} and IO

2005-08-13 Thread Nicholas Clark
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"

Re: BEGIN {...} and IO

2005-06-14 Thread Ingo Blechschmidt
Ingo Blechschmidt wrote: > # No problem: > my $data = BEGIN { > my $fh = open "some_file" err...; > =$fh; > }; > > # Problem; > my $fh = BEGIN { open "some_file" err... }; > # Compile-time filehandle leaked into runtime! > say =$fh; [...] > * There's a boolean property may_le

Re: BEGIN {...} and IO

2005-06-13 Thread Autrijus Tang
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 somet

Re: BEGIN {...} and IO

2005-06-13 Thread Ingo Blechschmidt
Hi, chromatic wrote: > On Mon, 2005-06-13 at 17:07 +0200, Ingo Blechschmidt wrote: >> # No problem: >> my $data = BEGIN { >> my $fh = open "some_file" err...; >> =$fh; >> }; >> >> # Problem; >> my $fh = BEGIN { open "some_file" err... }; >> # Compile-time filehandle leaked int

Re: BEGIN {...} and IO

2005-06-13 Thread chromatic
On Mon, 2005-06-13 at 17:07 +0200, Ingo Blechschmidt wrote: > # No problem: > my $data = BEGIN { > my $fh = open "some_file" err...; > =$fh; > }; > > # Problem; > my $fh = BEGIN { open "some_file" err... }; > # Compile-time filehandle leaked into runtime! > say =$fh; Perhap

BEGIN {...} and IO

2005-06-13 Thread Ingo Blechschmidt
Hi, # No problem: my $data = BEGIN { my $fh = open "some_file" err...; =$fh; }; # Problem; my $fh = BEGIN { open "some_file" err... }; # Compile-time filehandle leaked into runtime! say =$fh; In Perl 5, this wasn't a problem, as compilation and execution happended (most of