Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-15 Thread Autrijus Tang
On Tue, Mar 15, 2005 at 08:52:07AM -0800, Larry Wall wrote: > : That is fine because the three thunks are registered to the fh > : in evaluation order. What will be more fun is if they are all > : part of some other lazy lists, which may be accessed in some > : unpredictable order. > > You could

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-15 Thread Larry Wall
On Tue, Mar 15, 2005 at 12:46:49AM +0800, Autrijus Tang wrote: : On Mon, Mar 14, 2005 at 05:28:29PM +0100, Miroslav Silovic wrote: : > But it gets worse. : > : > my $lines = [ =$fh ]; : > seek($fh, 0); : > my $lines2 = [ =$fh ]; : > close $fh; : > : > $lines2 must somehow remember that seek has h

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-15 Thread Miroslav Silovic
[EMAIL PROTECTED] wrote: On the other hand, we can alternatively specify that closing a file handle must force all thunks associated to it, i.e. in this case fill @lines with real data. Pugs can do that just fine, but I have no idea how parrot is to achieve that... But it gets worse. my $lines

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Luke Palmer
Larry Wall writes: > The Principle of Maximum Differentiation of Similar Constructs also > tends to argue for eager =. Plus there's the fact that it's the sort > of restriction we can relax if we figure out how, but it would be hard > to impose if people started to rely on lazy assignment and then

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Larry Wall
On Mon, Mar 14, 2005 at 07:04:12PM +0100, Thomas Sandlaß wrote: : Yep. Does that put =, := etc into a category of operators that : are hard to (usefully) overload in classes? I mean the eager = : doesn't look like letting the left and right hand side have much : to do or decide in the process---oth

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Nigel Hamilton
: Given this Pugs program, t.p6: : : my $fh = open(@ARGS[0]); : my @lines = =$fh; : $fh.close(); : for @lines { print"$_" } : : running: : : pugs t.p6 t.p6 : : produces no output. Move $fh.close() to after the for : loop and all is well. Is this a bug? I wonder if IO::All could provide some inspira

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Thomas Sandlaß
Larry Wall wrote: The Principle of Maximum Differentiation of Similar Constructs also tends to argue for eager =. Plus there's the fact that it's the sort of restriction we can relax if we figure out how, but it would be hard to impose if people started to rely on lazy assignment and then we decid

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Larry Wall
The Principle of Maximum Differentiation of Similar Constructs also tends to argue for eager =. Plus there's the fact that it's the sort of restriction we can relax if we figure out how, but it would be hard to impose if people started to rely on lazy assignment and then we decided it was a bad id

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Larry Wall
On Mon, Mar 14, 2005 at 09:52:06AM -0700, Luke Palmer wrote: : Perhaps lists by assignment are COW lazy. So they behave just like : ordinary COW objects, except they can be lazy at the end: : : my @a = gather { : for 1... { : say; : take

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Larry Wall
On Tue, Mar 15, 2005 at 12:21:19AM +0800, Autrijus Tang wrote: : On Mon, Mar 14, 2005 at 08:06:08AM -0800, Larry Wall wrote: : > On Mon, Mar 14, 2005 at 10:58:00PM +1100, Andrew Savige wrote: : > : my $fh = open(@ARGS[0]); : > : my @lines = =$fh; : > : $fh.close(); : > : for @lines { print"$_" } :

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Luke Palmer
Autrijus Tang writes: > On Mon, Mar 14, 2005 at 08:06:08AM -0800, Larry Wall wrote: > > On Mon, Mar 14, 2005 at 10:58:00PM +1100, Andrew Savige wrote: > > : my $fh = open(@ARGS[0]); > > : my @lines = =$fh; > > : $fh.close(); > > : for @lines { print"$_" } > > : > > > > Hmm. It's probably a desig

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Autrijus Tang
On Mon, Mar 14, 2005 at 05:28:29PM +0100, Miroslav Silovic wrote: > But it gets worse. > > my $lines = [ =$fh ]; > seek($fh, 0); > my $lines2 = [ =$fh ]; > close $fh; > > $lines2 must somehow remember that seek has happened. That is fine because the three thunks are registered to the fh in evalu

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Autrijus Tang
On Mon, Mar 14, 2005 at 08:06:08AM -0800, Larry Wall wrote: > On Mon, Mar 14, 2005 at 10:58:00PM +1100, Andrew Savige wrote: > : my $fh = open(@ARGS[0]); > : my @lines = =$fh; > : $fh.close(); > : for @lines { print"$_" } > : > > Hmm. It's probably a design bug. I'm wondering if we have to spec

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Larry Wall
On Mon, Mar 14, 2005 at 10:58:00PM +1100, Andrew Savige wrote: : Given this Pugs program, t.p6: : : my $fh = open(@ARGS[0]); : my @lines = =$fh; : $fh.close(); : for @lines { print"$_" } : : running: : : pugs t.p6 t.p6 : : produces no output. Move $fh.close() to after the for : loop and all is