Re: explicitly declare closures???

2001-08-28 Thread Dave Mitchell
Ken Fox [EMAIL PROTECTED] wrote: We must be very careful not to confuse closure with Perl's current implementation of closure. You've stumbled onto a bug in Perl, not discovered a feature of closures. Perl's closures were horribly buggy until release 5.004. (Thanks Chip!) Er, no its not a

Re: explicitly declare closures???

2001-08-28 Thread Ken Fox
Dave Mitchell wrote: The whole point is that closed variables *aren't* 'just local variables'. The inner $x's in the following 2 lines are vastly different: sub foo { my $x= ... { $x } } sub foo { my $x= ... sub { $x } } You really need to learn what a closure is. There's a

Re: explicitly declare closures???

2001-08-28 Thread Dave Mitchell
Ken Fox [EMAIL PROTECTED] wrote: You really need to learn what a closure is. There's a very nice book called Structure and Interpretation of Computer Programs that can give you a deep understanding. ** Quite possibly I do. Anyway, I've now got the book on order :-) You're speaking in Perl

Re: explicitly declare closures???

2001-08-26 Thread Ken Fox
Dave Mitchell [EMAIL PROTECTED] wrote: John Porter [EMAIL PROTECTED] wrote: Dave Mitchell wrote: I think closures are a lot harder (or at least subtler) than people think ... ... The scenario you gave seems rather far-fetched to me, in terms of real-world programming. Perhaps,

Re: explicitly declare closures???

2001-08-26 Thread Tony Hall
Dave Mitchell [EMAIL PROTECTED] wrote: John Porter [EMAIL PROTECTED] wrote: Dave Mitchell wrote: I think closures are a lot harder (or at least subtler) than people think ... ... The scenario you gave seems rather far-fetched to me, in terms of real-world programming. Perhaps,

Re: explicitly declare closures???

2001-08-26 Thread Tony Hall
Dave Mitchell [EMAIL PROTECTED] wrote: John Porter [EMAIL PROTECTED] wrote: Dave Mitchell wrote: I think closures are a lot harder (or at least subtler) than people think ... ... The scenario you gave seems rather far-fetched to me, in terms of real-world programming. Perhaps,

Re: explicitly declare closures???

2001-08-22 Thread Dave Mitchell
Paul Johnson [EMAIL PROTECTED] wrote: Try changing your original example from sub foo { to *foo = sub { and you'll see that everything works as expected. add a BEGIN so that instantion happens at the same time that a named sub would be: BEGIN { * foo = sub { } } and the