Re: Perl6 Macros

2002-03-27 Thread Buddha Buck
Michel J Lambert <[EMAIL PROTECTED]> writes: > > > Macros could add something to Perl, but I don't see why having a macro > > return a string instead of looking and acting like a subroutine would be > > a bad thing. In fact, as I pointed out before, you can do almost all of > > the scoping stuff

Re: Perl6 Macros

2002-03-27 Thread Michel J Lambert
Basically, one of the goals of Perl6 was to allow for you to implement any perl construct, in perl. None of the operators were to use any special features that could not be done by regular subroutines. And personally, I don't see how we're going to be able to do all this lazy evaluation of paramet

Re: Perl6 Macros

2002-03-27 Thread Aaron Sherman
First impression: Don't go there. Longer answer: On Wed, 2002-03-27 at 16:29, Michel J Lambert wrote: > New syntax is 'qs', aka quote sub, which is similar to q, except that it > interpolates all of: ${..} @{..} and %{..} > All subroutines which are interpolated, are interpolated as regular text

Re: Perl6 Macros

2002-03-27 Thread Michel J Lambert
New syntax is 'qs', aka quote sub, which is similar to q, except that it interpolates all of: ${..} @{..} and %{..} All subroutines which are interpolated, are interpolated as regular text, with no bindings, so that they get lexically scoped in the code they are returned as part of. Then macros es

Re: Perl6 Macros

2002-03-27 Thread Michel J Lambert
> > An example of where variable capture is needed is: > > macro println ($a) { > > return <<"EOF"; > > print $a; > > print "\n"; > > EOF > > } > > for my $b (1..100) { > > println $b; > > } > > And, if we inline the sub, the only difference will be...? Okay, a bad example, in that it cou

Re: Perl6 Macros

2002-03-27 Thread Aaron Sherman
On Wed, 2002-03-27 at 11:31, Dan Sugalski wrote: > At 10:27 AM -0500 3/27/02, Aaron Sherman wrote: > > macro mygrep ($code is macroblock, *@list) { > > my @newlist = (); > > for @list { > > push @newlist, $_ if $code.(); > > } > > return @newlist; > > } > >

Re: Perl6 Macros

2002-03-27 Thread Larry Wall
Dan Sugalski writes: : Just out of curiosity, is there anything macros (in the Lisp sense) : can do that source filters can't? Avoid reparsing the language themselves? Larry

Re: Topicalizers: Why does when's EXPR pay attention to topicaliz er r egardless of associated variable?

2002-03-27 Thread Larry Wall
Eric Roode writes: : Larry Wall writes: : > I think if we have to go through contortions to get at the outer topic : > by name, it's better to just name the variable on the outer loop in the : > first place. Adding -> $varname to the outer loop is safe, because it : > doesn't change the seman

Re: Perl6 Macros

2002-03-27 Thread Dan Sugalski
At 10:27 AM -0500 3/27/02, Aaron Sherman wrote: >I *can* see some advantage in: > > macro mygrep ($code is macroblock, *@list) { > my @newlist = (); > for @list { > push @newlist, $_ if $code.(); > } > return @newlist; > } > @x = mygrep {/\S/} $fh.getlin

Re: Topicalizers: Why does when's EXPR pay attention to topicaliz er r egardless of associated variable?

2002-03-27 Thread Eric Roode
Larry Wall writes: > I think if we have to go through contortions to get at the outer topic > by name, it's better to just name the variable on the outer loop in the > first place. Adding -> $varname to the outer loop is safe, because it > doesn't change the semantics of topicality--now that

Re: Topicalizers: Why does when's EXPR pay attention to topicaliz er r egardless of associated variable?

2002-03-27 Thread Larry Wall
Aaron Sherman writes: : Here's an example syntax: : : FOO: for @x { : BAR: for @y { : my $foo_under FOO:= $_; : print $_, $foo_under; : } : } I think if we have to go through contortions to get at the outer topic by name, it's better to just name the variable on the outer loop in the

Re: Perl6 Macros

2002-03-27 Thread Aaron Sherman
On Tue, 2002-03-26 at 16:26, Michel J Lambert wrote: > An example of where variable capture is needed is: > macro println ($a) { > return <<"EOF"; > print $a; > print "\n"; > EOF > } > for my $b (1..100) { > println $b; > } Ok, I don't get it. I'm willing to concede that I'm dense, but I

Re: Topicalizers: Why does when's EXPR pay attention to topicalizer r egardless of associated variable?

2002-03-27 Thread Aaron Sherman
On Tue, 2002-03-26 at 13:19, Larry Wall wrote: > Aaron Sherman writes: > : Ok, so am I to take it that you could say: > : > : FOO: for @x { > : BAR: for @y { > : print $FOO::_; > : } > : } > > Er, I don't think so. > > : Or is OUTER a special-case label? > > It's a special case like M