Re: How much do we close over?

2005-06-13 Thread Chip Salzenberg
On Sun, Jun 12, 2005 at 11:26:49PM +0100, Piers Cawley wrote: sub foo { my $x = 1; return sub { eval $^codestring } } say foo()($x); I'm pretty sure you meant single-quoted, and you perhaps might maybe need a dot there: sub foo { my $x = 1; return sub { eval $^codestring } }

Re: How much do we close over?

2005-06-13 Thread Autrijus Tang
On Mon, Jun 13, 2005 at 12:57:32AM +0200, Chip Salzenberg wrote: On Sun, Jun 12, 2005 at 11:26:49PM +0100, Piers Cawley wrote: sub foo { my $x = 1; return sub { eval $^codestring } } say foo()($x); I'm pretty sure you meant single-quoted, and you perhaps might maybe need a dot

Re: How much do we close over?

2005-06-13 Thread Piers Cawley
Rob Kinyon [EMAIL PROTECTED] writes: Piers Cawley said: in other words, some way of declaring that a subroutine wants to hang onto every lexical it can see in its lexical stack, not matter what static analysis may say. I'm not arguing with the idea, in general. I just want to point out

Re: How much do we close over?

2005-06-13 Thread Piers Cawley
Rod Adams [EMAIL PROTECTED] writes: Piers Cawley wrote: Chip and I have been having a discussion. I want to write: sub foo { my $x = 1; return sub { eval $^codestring } } say foo()($x); I claim that that should print 1. Chip claims it should throw a warning about because of timely

Re: How much do we close over?

2005-06-13 Thread Luke Palmer
On 6/12/05, Piers Cawley [EMAIL PROTECTED] wrote: Chip and I have been having a discussion. I want to write: sub foo { my $x = 1; return sub { eval $^codestring } } say foo()($x); I claim that that should print 1. Chip claims it should throw a warning about because of timely

Optimisations (was Re: How much do we close over?)

2005-06-13 Thread Paul Johnson
On Mon, Jun 13, 2005 at 11:24:07AM +, Luke Palmer wrote: I just have to say that it's really annoying running into optimizations when I don't want them. Isn't the whole point of optimisations that you shouldn't have to worry about whether you hit one or not, otherwise the optimisation

Re: Optimisations (was Re: How much do we close over?)

2005-06-13 Thread Luke Palmer
On 6/13/05, Paul Johnson [EMAIL PROTECTED] wrote: On Mon, Jun 13, 2005 at 11:24:07AM +, Luke Palmer wrote: Back when I wrote an back-chaining system in perl, I used tied variables in order to determine when I needed to solve for something. A

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 the

Anonymous macros?

2005-06-13 Thread Ingo Blechschmidt
Hi, just checking: Are anonymous macros allowed? my $macro = macro ($x) { 100$x }; say $macro(3); # 1003 Of course, anonymous macros can't be called at compile-time, like normal macros: my $macro = rand 0.5 ?? macro ($x) { 100$x } :: macro ($x) { 200$x }; say $macro(3); # 1003

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; Perhaps I'm being

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 into runtime! say

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 something, but I

Re: Anonymous macros?

2005-06-13 Thread Larry Wall
On Mon, Jun 13, 2005 at 05:25:59PM +0200, Ingo Blechschmidt wrote: : just checking: Are anonymous macros allowed? I have no problem with macros being first-class objects during the compile. Though the macro itself may have a problem with your passing it '3' when it is likely expecting an AST.

Re: State of Design Documents

2005-06-13 Thread Patrick R. Michaud
On Fri, Jun 10, 2005 at 02:36:52PM -0400, Joshua Gatcomb wrote: Ok, are there any guidelines for what should and should not be put forward as a patch. I can see 3 key areas of concern: 1. Framework for unwritten Synopses (so we know what goes where) 2. Heading placeholders for written

Re: State of Design Documents

2005-06-13 Thread Patrick R. Michaud
On Mon, Jun 13, 2005 at 02:22:59PM -0500, Patrick R. Michaud wrote: On Fri, Jun 10, 2005 at 02:36:52PM -0400, Joshua Gatcomb wrote: Ok, are there any guidelines for what should and should not be put forward as a patch. [...] For anything that doesn't come from @Larry or $Larry, I think we

Re: State of Design Documents

2005-06-13 Thread Patrick R. Michaud
On Mon, Jun 13, 2005 at 02:22:59PM -0500, Patrick R. Michaud wrote: On Fri, Jun 10, 2005 at 02:36:52PM -0400, Joshua Gatcomb wrote: I have included a sample framework for chapter 17. Theoretically, someone could then go search the archives for decision points in any of those headings and

Perl defined Object, Array, Hash classes

2005-06-13 Thread Eric
Hey, Found out this morning that wizard.p6 suddenly stopped wondering and I was stumped as to why. The autrijus came along and pointed out that i was defineing an Object class of my own. This was obliterating the built in class causing all other classes to fail to work at all. It would seem

Re: Perl defined Object, Array, Hash classes

2005-06-13 Thread Larry Wall
You shouldn't be able to reopen/clobber an existing class/module unless you specify class Object is augmented {...} class Object is replaced {...} or some such (the trait names are still negotiable). In general, private classes should start with my or our, though I don't know if Pugs