Re: musings: write some perl ops in perl

2001-08-22 Thread Tim Bunce
Larry's already said (from memory) that the distinction between ops and subs should be minimized or eliminated. That, together with the desire to keep parrot fairly language netural, leads naturally to having 'heavy' ops actually be be subs. Tim. On Fri, Aug 17, 2001 at 06:02:44PM -0400, Uri Gu

RE: explicitly declare closures???

2001-08-22 Thread Sterin, Ilya
As was mentioned earlier, a closure can as well be a named sub, not necessarily an anonymous. Ilya -Original Message- From: Paul Johnson To: Dave Mitchell Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 08/21/2001 11:39 AM Subject: Re: explicitly declare closures??? On Tue, Aug 21, 2001

Re: explicitly declare closures???

2001-08-22 Thread Paul Johnson
On Wed, Aug 22, 2001 at 10:34:49AM +0100, Dave Mitchell wrote: > Paul Johnson <[EMAIL PROTECTED]> wrote: > > Actually, foo() is not a closure. A closure is an anonymous subroutine > > and foo() clearly has a name. > > Damain's definition of a closure includes named subs: > > "In Perl, a closure

Re: explicitly declare closures???

2001-08-22 Thread Paul Johnson
On Tue, Aug 21, 2001 at 06:06:06PM +0100, Dave Mitchell wrote: > Piers Cawley <[EMAIL PROTECTED]> wrote: > > > { > > > my $x = "bar"; > > > sub foo { > > > # $x # <- uncommenting this line changes the outcome > > > return sub {$x}; > > > } > > > } > > > print foo()->(); > > > > W

Re: explicitly declare closures???

2001-08-22 Thread Dave Mitchell
John Porter <[EMAIL PROTECTED]> wrote: > Dave Mitchell wrote: > > I think closures are a lot harder (or at least subtler) than people > > think, > > It's hard for me to agree with you, because I've never had *any* > problems with closures. (And yes, I use them all the time.) > The scenario you g

Re: explicitly declare closures???

2001-08-22 Thread John Porter
Dave Mitchell wrote: > I think closures are a lot harder (or at least subtler) than people > think, It's hard for me to agree with you, because I've never had *any* problems with closures. (And yes, I use them all the time.) The scenario you gave seems rather far-fetched to me, in terms of real-

Re: explicitly declare closures???

2001-08-22 Thread Randal L. Schwartz
> "Dave" == Dave Mitchell <[EMAIL PROTECTED]> writes: Dave> Paul Johnson <[EMAIL PROTECTED]> wrote: >> Actually, foo() is not a closure. A closure is an anonymous subroutine >> and foo() clearly has a name. Dave> Damain's definition of a closure includes named subs: Dave> "In Perl, a closu

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 { } }

Re: explicitly declare closures???

2001-08-22 Thread Dave Mitchell
> I guess you missed where I suggested that putting "my" on that > declaration is also counter-sensical, not to mention redundant. > "my" implies a brand-spanking-new lexical variable attached > to this very scope. The semantics of "outer" (or "closed"...) > can be defined to imply a lexical var

Re: explicitly declare closures???

2001-08-22 Thread Dave Mitchell
Paul Johnson <[EMAIL PROTECTED]> wrote: > Actually, foo() is not a closure. A closure is an anonymous subroutine > and foo() clearly has a name. Damain's definition of a closure includes named subs: "In Perl, a closure is just a subroutine that refers to one or more lexical variables declared o