Re: [perl #40955] [BUG] :anon .subs aren't anchored to a namespace

2006-11-22 Thread Allison Randal
Ben Morrow wrote: ...but that's just a braino on Matt's part, and his point still stands for the code package Test; sub apply { my $func = shift; $func->(shift) while @_; } package Foo; use vars qw/$line/; # can't use our as that also creates a lexical

Re: :anon Subs and Namespaces

2006-11-22 Thread Allison Randal
Matt Diephouse wrote: Let's try this again, starting from the Tcl side of things. Tcl code can exist outside of subroutines. This, for example, is a valid Tcl program: set number 5 puts $number [...] But things get a little hairier when we start using namespaces in Tcl: namespace eval t

Re: Closures, compile time, pad protos

2006-11-22 Thread Anatoly Vorobey
First of all, thanks a lot for your comments. On Wed, Nov 22, 2006 at 06:43:12PM -0500, Buddha Buck wrote: > >{ > > my $x = something(); > > if $x==1 { > >...code... > > } > >} > > > My experience with other statically typed by extremely flexable > languages is that the pads tend to be arra

Re: pmc2c.pl --dump : What Files Does Makefile Supply as @ARGV

2006-11-22 Thread chromatic
On Wednesday 22 November 2006 16:04, James E Keenan wrote: > And now, a question about how the Parrot Makefile utilizes pmc2c.pl ... > > The Makefile calls: > >PMC2CD = $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --dump > > ... which inside pmc2c.pl translates into: > >dump_pmc([EMAIL PROTECTED],

pmc2c.pl --dump : What Files Does Makefile Supply as @ARGV

2006-11-22 Thread James E Keenan
And now, a question about how the Parrot Makefile utilizes pmc2c.pl ... The Makefile calls: PMC2CD = $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --dump ... which inside pmc2c.pl translates into: dump_pmc([EMAIL PROTECTED], @ARGV); What kind of files does the Makefile place in @ARGV? I need to fi

Re: Closures, compile time, pad protos

2006-11-22 Thread Buddha Buck
Keep in mind that I am only an egg, and I am putting my intuition and experience with similar languages to mind. Perl6 might be doing things differently than I expect. On 11/22/06, Anatoly Vorobey <[EMAIL PROTECTED]> wrote: To add some more confusion to what Yuval wrote: In general, it doesn't

Re: [perl #40955] [BUG] :anon .subs aren't anchored to a namespace

2006-11-22 Thread Ben Morrow
Quoth [EMAIL PROTECTED] (Allison Randal): > Matt Diephouse wrote: > > > > Consider the following Perl 5 code: > > > > package Test; > > sub apply { > > my $func = shift; > > $func->(shift) while @_; > > } > > package Foo; > > my $line = 0; > > my $func = sub { print $line++, " ",

[perl #40972] Iterator over Env under Win32

2006-11-22 Thread via RT
# New Ticket Created by Bernhard Schmalhofer # Please include the string: [perl #40972] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=40972 > Hi, in t/pmc/env.t I noticed that an Iterator test is skipped under Win23:

Re: Closures, compile time, pad protos

2006-11-22 Thread Anatoly Vorobey
To add some more confusion to what Yuval wrote: In general, it doesn't seem to be very clear how inner (lexically) subs see their enclosing lexical environments. Possibly I'm simply very confused, in which case un-confusing me would be much appreciated. Here're some code snippets. { my $x =

Re: [perl #40968] [BUG] :multi doesn't seem to work right

2006-11-22 Thread Leopold Toetsch
Am Mittwoch, 22. November 2006 21:03 schrieb Leopold Toetsch: > Am Mittwoch, 22. November 2006 18:03 schrieb Patrick R.Michaud: > > Is this a bug (I think it is), or does the underscore in > > > > :multi mean something other than "any argument"? > > The meaning is 'any PMC' [1], and it of course ca

Re: [perl #40968] [BUG] :multi doesn't seem to work right

2006-11-22 Thread Leopold Toetsch
Am Mittwoch, 22. November 2006 18:03 schrieb Patrick R.Michaud: > Is this a bug (I think it is), or does the underscore in > > :multi mean something other than "any argument"? The meaning is 'any PMC' [1], and it of course can't be a bug as there are no specs ;) leo [1] multi_type: compilers/i

Re: Closures, compile time, pad protos

2006-11-22 Thread Yuval Kogman
On Wed, Nov 22, 2006 at 18:55:15 +0100, Juerd wrote: > Yuval Kogman skribis 2006-11-22 16:01 (+0200): > > my $x ::= 3; > > sub foo { say ++$x }; > > Why would you be allowed to ++ this $x? It's bound to an rvalue! Perhaps my $x ::= BEGIN { Scalar.new( :value(3) ) } What w

Re: Closures, compile time, pad protos

2006-11-22 Thread Juerd
Yuval Kogman skribis 2006-11-22 16:01 (+0200): > my $x ::= 3; > sub foo { say ++$x }; Why would you be allowed to ++ this $x? It's bound to an rvalue! -- korajn salutojn, juerd waalboer: perl hacker <[EMAIL PROTECTED]> convolution: ict

[perl #40966] [BUG] Parrot core dumps in perl6 (possible GC/pointer bug?)

2006-11-22 Thread via RT
# New Ticket Created by Patrick R. Michaud # Please include the string: [perl #40966] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=40966 > --- osname= linux osvers= 2.6.16 arch= x86_64-linux-thread-multi cc= cc ---

[perl #40968] [BUG] :multi doesn't seem to work right

2006-11-22 Thread via RT
# New Ticket Created by Patrick R. Michaud # Please include the string: [perl #40968] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=40968 > I'm filing this as a bug report, but it could just be that I don't understand how

Re: Closures, compile time, pad protos

2006-11-22 Thread Yuval Kogman
And what about: foo(); for 1..3 { my $x ::= 3; sub foo { say ++$x }; say ++$x }; BEGIN { foo(); foo(); } or worse: sub moose { my $x = 3;

Closures, compile time, pad protos

2006-11-22 Thread Yuval Kogman
Hi, Anatoly and I don't know what this bit of code prints: foo(); foo(); for 1..3 { my $x ::= 3; sub foo { say ++$x }; say ++$x }; Is it 4, 5, 6, 6, 6 or 4, 5, 3, 3, 3? It's almost definitely not 4, 5, 6, 7, 8. I c

Re: 3 subroutines with same name

2006-11-22 Thread James E Keenan
chromatic wrote: On Tuesday 21 November 2006 18:36, James E Keenan wrote: 3 identically named subroutines: 2 in modules and 1 in a script. And all 3 will be in modules as I'm planning to refactor much of pmc2c.pl into a module called Parrot::Pmc2c::Utils. (For drafts of these revisions, se

:anon Subs and Namespaces

2006-11-22 Thread Matt Diephouse
Let's try this again, starting from the Tcl side of things. Tcl code can exist outside of subroutines. This, for example, is a valid Tcl program: set number 5 puts $number In order to compile this to PIR, we have to put it into a subroutine. The only problem with putting it into a subroutine i