(thread intentionally broken)
Nathan Torkington wrote:
Steve Fink writes:
True. Would anyone mourn @$scalar_containing_variable_name if it died?
I've never used it, and I'm rather glad I haven't. Perl5's -w doesn't
notice $x="var"; print @$x either -- it'll complain if you mention @var
Steve Fink writes:
My code for doing what I thought Exporter did is:
sub import {
my $p = caller(1);
*{"${p}::E"} = \%{"${p}::E"};
}
but that doesn't run afoul of use strict 'refs'. Can you point me to the
passage in Exporter.pm that uses this?
It does run afoul of use strict
Thanks! Ok, from a type inferencing perspective...
Nathan Torkington wrote:
Symbolic references are used for dynamic function generation:
foreach my $func (qw(red green blue)) {
*$func = sub { "FONT COLOR=$func@_/FONT" }
}
Probably have to punt on checking user code in a main
Thus it was written in the epistle of Steve Fink,
Which has next to nothing to do with any particular issue. And it's too
hard to argue when we agree.
:-).
If I asked you which variable $x[4] is accessing, I bet you'd say @x.
Which is one source of the confusion -- in one case, you use
Today around 2:04pm, Casey R. Tweten hammered out this masterpiece:
: Today around 10:45am, Steve Fink hammered out this masterpiece:
:
: : Ted Ashton wrote:
: :
: : all
: : dereferencing can be done with -.
: :
: : Is that
Don't forget that the rationale behind the infix dereferencing is
this:
@variable_name
@{variable_name}
@$scalar_containing_variable_name @$scalar_containing_value_ref
@{ code evaluating to variable name } @{ code giving value ref }
Nat
Mike Pastore wrote:
On Wed, 16 Aug 2000, John Porter wrote:
grep() always treats its "second" arg as a list, even if it's a scalar,
or some other list-of-one (or none); and grep() always returns a list,
even if it's a list of one (or none).
True on the first part, false on the second.
Karl Glazebrook wrote:
But what is $x[3] ?
It could be a scalar.
BUT it could be a reference to a list.
It could be a reference to a 2D PDL image.
... but references are scalar. So, $x[3] *is* a scalar.
That scalar could be a reference to a list. It could be a reference to a 2D
PDL
Ted Ashton wrote:
But the most direct way to measure how well the
language slides into people's heads is by seeing how hard it is for them
to get the hang of it.
Nope. I've yet to be convinced that "fits in your head" is the same as
"went in easily". Hang it all,
Karl Glazebrook wrote:
Ariel Scolnicov wrote:
Karl Glazebrook [EMAIL PROTECTED] writes:
[...]
o Why do I think perl has too much line noise? Because of code like this:
@{$x-{$$fred{Blah}}}[1..3]
This is indeed horrible. However, I fail to see how cutting out the
On Thu, Aug 17, 2000 at 03:10:44PM -0700, Steve Fink wrote:
My proposal would be what I implemented for perl5 a while back (Sarathy
didn't dislike it, but wasn't convinced enough to put it in): all
dereferencing can be done with -.
$x-@ is the same as @$x
$x-% is the same as %$x
Karl Glazebrook [EMAIL PROTECTED] writes:
o Why do I think perl has too much line noise? Because of code like this:
@{$x-{$$fred{Blah}}}[1..3]
You're taking the value of the key "Blah" in the hash referred to by $fred
and using it as the key into the hash referred to by $x, treating the
Thus it was written in the epistle of Steve Fink,
Bah. I will claim neither that being easy to learn is Perl's main goal,
nor that I know what Perl's main goal is, but I have enough of an
intuition (or did I misspell "opinion"?) to assert that ease of learning
is a far more important
I thought very carefully about this before writing the Highlander
Variables RFC, and came to the conclusion that it's a bad idea.
I've read your proposal, but I'm afraid I still think it's a bad idea.
Those funny characters tell the programmer what's going on, and they
tell the compiler what the
[EMAIL PROTECTED] (Nathan Torkington) wrote on 15.08.00 in
[EMAIL PROTECTED]:
* you misunderstand the purpose of $ and @, which is to indicate
singular vs plural.
Yes. That's one of the things that's wrong with it - maybe the biggest of
all.
It's one of the things that require
[EMAIL PROTECTED] (Russ Allbery) wrote on 15.08.00 in
[EMAIL PROTECTED]:
All variables should be C$x. They should behave appropriately
according to their object types and methods.
No thanks. I frequently use variables $foo, @foo, and %foo at the same
time when they contain the same
Damien Neil wrote:
What makes you presume this? Perhaps snrub() is something like this:
sub snrub {
foreach (@_) {
frobnicate $_;
}
}
You appear to arguing that expressions in function argument lists should
not be evaluated in a list context. Is this really what
Damien Neil wrote:
On Tue, Aug 15, 2000 at 05:45:04PM -0400, Karl Glazebrook wrote:
I hope people will actually read the RFC before coming back with these
canned responses which I (and presumably everyone else on this list)
am completely familiar with. I used to believe that too!
"J. David Blackstone" wrote:
=head1 TITLE
Less line noise - let's get rid of @%
I understand that with the pervasiveness of object-orientation we
are now more than ever seeing objects that behave like arrays and
hashes and that it seems strange to see these listlike or hashlike
Jonathan Scott Duff wrote:
As for $a[$something], if @a had been declared as
"my @a : assoc;", then perl should stringify $something, otherwise
numify. Hmm.. I guess this implies that all hashes need to be
pre-declared. :-(
That was kinda along the lines of my suggestion; that the behavior
"J. David Blackstone" [EMAIL PROTECTED] writes:
I find the standard prefix symbols so intuitive I find it hard to
articulate the reasons why I balk at giving them up. It's like
explaining breathing or the ability to distinguish colors.
Bravo! What he said! Hear, hear!
[FX: Waves order
John Porter [EMAIL PROTECTED] writes:
Russ Allbery wrote:
$args = 'first second third';
@args = split (' ', $args);
my $i = 0;
%args = map { $_ = ++$i } @args;
This is very Perlish to me; the punctuation is part of the variable
name and disambiguates nicely.
No, it's
Karl Glazebrook writes:
Well said!
My take: I like perl, I don't mind it the way it is. But I'd be happier if
it was a lot more like python! (indentation aside)
This begs the question of why you're not using python. If it's just
indentation, that's silly. Surely there are patches to the
What makes Perl feel like Perl is, of course, subjective, but to me
the punctuation is a lot of it. We're trying to improve Perl, not
replace it.
This is an extremely loaded statement, and we've been hearing it a lot.
RFC 0, remember? Invoking RFC0 immediately after stating your own
Karl Glazebrook wrote:
Jon Ericson wrote:
I've spent almost a day trying to come up with a polite response to this
suggestion. I have started this mail 3 or 4 times but deleted what I
wrote because it was too sarcastic, angry or dismissive. This RFC
Thanks!
strikes to the very
On Wed, 16 Aug 2000, David Corbin wrote:
Mike Pastore wrote:
$hashish{'dog'}# one whutzit
@hashish{'dog', 'cat'} # more than one whutzits
each %hashish # one whutzit, indexed
%hashish # all whutzits, indexed
keys %hashish #
Mike Pastore wrote:
Scenario 2:
ret = grep(/hand/, var);
*puzzled expression* "Grepping a scalar for a string? Grepping a list for
a string? Returning a list or a scalar?"
You have failed to enter the mind of an expert perl programmer. ;-)
grep() always treats its "second" arg as
Real quick:
On Wed, 16 Aug 2000, John Porter wrote:
grep() always treats its "second" arg as a list, even if it's a scalar,
or some other list-of-one (or none); and grep() always returns a list,
even if it's a list of one (or none).
True on the first part, false on the second. In scalar
John Porter wrote:
Russ Allbery wrote:
$args = 'first second third';
@args = split (' ', $args);
my $i = 0;
%args = map { $_ = ++$i } @args;
This is very Perlish to me; the punctuation is part of the variable name
and disambiguates nicely.
No, it's not. Where
On Wed, Aug 16, 2000 at 10:38:30AM -0600, John Barnette wrote:
John Porter wrote:
Russ Allbery wrote:
$args = 'first second third';
@args = split (' ', $args);
my $i = 0;
%args = map { $_ = ++$i } @args;
This is very Perlish to me; the punctuation is part of
Jonathan Scott Duff wrote:
Gee, I'd hate to lose simple assignment to a hash from a list.
foo %= bar;
Hmm, I think I need to write an RFC!
--
John Porter
On Wed, Aug 16, 2000 at 12:44:50PM -0400, John Porter wrote:
Jonathan Scott Duff wrote:
Gee, I'd hate to lose simple assignment to a hash from a list.
foo %= bar;
Hmm, I think I need to write an RFC!
I'll give you my comments right now ... It seems we are eliminating
No, it's not. Where are we taught this? It's a myth.
The punctuation imposes context on the variable expression.
$foo[0]
accesses an array. Where's the "@"?
It accesses an *element* of the array, which is a scalar. This scalar
might be blessed into a class, or a
On Wed, Aug 16, 2000 at 10:04:22AM -0700, Damien Neil wrote:
I'm not certain that I like the idea of string-indexed arrays; I don't
know that I like the thought that $a[5] and $a[05] might suddenly
mean something different.
They wouldn't. In $a[05], 05 is a number. To get a string, quotes
Russ Allbery wrote:
$args = 'first second third';
@args = split (' ', $args);
my $i = 0;
%args = map { $_ = ++$i } @args;
This is very Perlish to me; the punctuation is part of the variable name
and disambiguates nicely.
No, it's not. Where are we taught this? It's
Perl6 RFC Librarian wrote:
[snip reconstructionist history and newer-is-better fallacy]
I argue in this Brave New World the distinction between C$x, C@x and
C%x are no longer useful and should be abolished. We might want
to use all kinds of array objects, why should @x be special? Rather
Jon Ericson wrote:
Perl6 RFC Librarian wrote:
[snip reconstructionist history and newer-is-better fallacy]
I argue in this Brave New World the distinction between C$x, C@x and
C%x are no longer useful and should be abolished. We might want
to use all kinds of array objects, why
On Tue, Aug 15, 2000 at 05:45:04PM -0400, Karl Glazebrook wrote:
I hope people will actually read the RFC before coming back with these
canned responses which I (and presumably everyone else on this list)
am completely familiar with. I used to believe that too! Honest...
I think you do a
38 matches
Mail list logo