On Fri, Apr 12, 2002 at 05:34:13PM -0700, Glenn Linderman wrote:
Allison Randal wrote:
In a message dated Fri, 12 Apr 2002, Glenn Linderman writes:
$_ becomes lexical
Sound logic. And it almost did go that way. But subs that access the
current $_ directly are far too common, and far
Allison Randal wrote:
What if $_ were dynamically scoped, but only for subroutines? Dynamic
scoping is not necessarily the same thing as a global $_. It would
merely pretend (only for $_) that the subroutine had been defined in the
scope where it was evaluated. But that could get you into
There'd be an interaction between is topic_preserving, default parameter
values, and explicit parameter values which should be clarified. Now I
understand why someone suggested using //= $_ instead of is
topic_preserving, somewhere along the line. Clearly if the user
supplies the
On Sat, Apr 13, 2002 at 08:53:41AM -0700, Glenn Linderman wrote:
Off hand, it seems like defaulting to is dynamic_topic would make
more of those common useful $_-dependent subroutines work without
change, but I guess if the perl 5 to 6 translator can detect use of $_
before definition of $_
Trey Harris [EMAIL PROTECTED] writes:
I think I've missed something, even after poring over the archives for
some hours looking for the answer. How does one write defaulting
subroutines a la builtins like print() and chomp()? Assume the code:
for {
printRec;
}
printRec
On Fri, 2002-04-12 at 04:26, Piers Cawley wrote:
Trey Harris [EMAIL PROTECTED] writes:
I think I've missed something, even after poring over the archives for
some hours looking for the answer. How does one write defaulting
subroutines a la builtins like print() and chomp()? Assume the
On Fri, Apr 12, 2002 at 09:40:16AM -0400, Aaron Sherman wrote:
On Fri, 2002-04-12 at 04:26, Piers Cawley wrote:
Trey Harris [EMAIL PROTECTED] writes:
I think I've missed something, even after poring over the archives for
some hours looking for the answer. How does one write
On Fri, Apr 12, 2002 at 09:26:45AM +0100, Piers Cawley wrote:
Trey Harris [EMAIL PROTECTED] writes:
I think I've missed something, even after poring over the archives for
some hours looking for the answer. How does one write defaulting
subroutines a la builtins like print() and chomp()?
On Fri, 2002-04-12 at 09:52, Jonathan Scott Duff wrote:
On Fri, Apr 12, 2002 at 09:40:16AM -0400, Aaron Sherman wrote:
sub printRec() { printRec($_) } # No args, therefore no new topic.
sub printRec($rec) { .chomp; print :$rec:\n } # 1 arg
I think was he was saying is
- Original Message -
From: Graham Barr [EMAIL PROTECTED]
Hm, I wonder if
sub printRec($rec=$_) { ... }
or someother way to specify that the current topic be used
as a default argument, might be possible
Would it would be reasonable to have given default to the caller's topic?
In a message dated Fri, 12 Apr 2002, Ashley Winters writes:
Would it would be reasonable to have given default to the caller's topic?
sub printRec {
given {
# $_ is now the caller's topic in this scope
}
}
Perhaps Cgiven caller.topic {} would work as well.
Yes, something
On Fri, 12 Apr 2002, Trey Harris wrote:
I think I've missed something, even after poring over the archives for
some hours looking for the answer. How does one write defaulting
subroutines a la builtins like print() and chomp()? Assume the code:
for {
printRec;
}
printRec
In a message dated Fri, 12 Apr 2002, Luke Palmer writes:
Couldn't you do it with old-style Perl5 subs?
sub printRec {
my $p = chomp(shift // $_);
print :$_:\n
}
Or am _I_ missing something?
That definitely won't work (aside from the $p/$_ swap which I assume is
unintentional),
Oops, caught my own mistake...
In a message dated Fri, 12 Apr 2002, Trey Harris writes:
In a message dated Fri, 12 Apr 2002, Luke Palmer writes:
sub printRec {
my $p = chomp(shift // $_);
print :$_:\n
}
[Should be equivalent to]
sub printRec {
my $p = chomp(shift //
In a message dated Fri, 12 Apr 2002, Glenn Linderman writes:
$_ becomes lexical
$_ gets aliased to the first topic of a given clause (hence changes
value more often, but the lexical scoping helps reduce that impact)
Okay. But it sounds like you're saying that Cgiven, and Cgiven only,
On Fri, Apr 12, 2002 at 02:44:38AM -0400, Trey Harris wrote:
I think I've missed something, even after poring over the archives for
some hours looking for the answer. How does one write defaulting
subroutines a la builtins like print() and chomp()? Assume the code:
for {
printRec;
Okay, first thing to keep in mind, this hasn't been finally-finalized
yet. Alot was hashed out in the process of proofing E4, but there will
be more to come.
On Fri, Apr 12, 2002 at 07:39:17PM -0400, Trey Harris wrote:
In a message dated Fri, 12 Apr 2002, Glenn Linderman writes:
$_ becomes
Allison Randal wrote:
In a message dated Fri, 12 Apr 2002, Glenn Linderman writes:
$_ becomes lexical
Sound logic. And it almost did go that way. But subs that access the
current $_ directly are far too common, and far to useful.
One thing I'm missing is how those common useful subs that
18 matches
Mail list logo