On Sun, Sep 12, 2010 at 2:10 PM, Shawn H Corey shawnhco...@gmail.comwrote:
On 10-09-12 04:58 PM, Aristotle Pagaltzis wrote:
* Shawn H Coreyshawnhco...@gmail.com [2010-09-10 14:30]:
On 10-09-10 03:02 AM, Eric Wilhelm wrote:
sub foo {
my $self = shift;
my $self = shift
Aristotle Pagaltzis pagalt...@gmx.de writes:
You don’t want to reach inside an object just
because it happens to be hash-based.
Interesting. For Getopt::Long (that can take an optional hashref as its
first argument) I got explicit requests from users to allow hash based
objects as well.
--
(
50_000_000,
{
'shift' = sub {_shift(@args)},
'copy' = sub {_copy(@args)},
}
);
sub _shift {my $self = shift; my ($x, $y, $z)=...@_ ; my $r = $x + $y + $z ;
return $r ;}
sub _copy {my ($self, $x, $y,$z) =...@_; my $r = $x + $y + $z
On Mon, Sep 13, 2010 at 08:00:01AM +0200, Johan Vromans wrote:
Aristotle Pagaltzis pagalt...@gmx.de writes:
You don???t want to reach inside an object just
because it happens to be hash-based.
Interesting. For Getopt::Long (that can take an optional hashref as its
first argument) I got
On Mon, 13 Sep 2010, Nadim Khemir wrote:
The surprise was that there was an up to 6% speed difference and the
biggest surprise is the inversion of which method is fastest.
I'm curious, someone care to comment?
In any real application, it's highly unlikely that the spped will be
affected by
On 10-09-13 07:50 AM, Nadim Khemir wrote:
I'm curious, someone care to comment?
I'm surprised that a specialized variable like @_ is not optimized for
shift. All that is needed is to more the pointer to the next item in
the array. The space used by the previous first item need not be
Shawn H Corey said:
On 10-09-13 07:50 AM, Nadim Khemir wrote:
I'm curious, someone care to comment?
I'm surprised that a specialized variable like @_ is not optimized for
shift. All that is needed is to more the pointer to the next item in
the array. The space used by the previous first
On Mon, Sep 13, 2010 at 11:48 AM, Ryan Voots simcop2...@simcop2387.info wrote:
sub foo {
my $foo = shift;
$foo = bar; }
would not doing a copy for shift like that cause it to act like
sub foo {$_[0] = bar} does?
Well, you know what they say: Try It And See.
On 10-09-13 01:16 PM, Jonathan Yu wrote:
Well, you know what they say: Try It And See.
I thought that was: TITS (Try It To See)
http://www.perlmonks.org/?node_id=545998
--
Just my 0.0002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it
* Johan Vromans jvrom...@squirrel.nl [2010-09-13 08:05]:
Aristotle Pagaltzis pagalt...@gmx.de writes:
You don’t want to reach inside an object just because it
happens to be hash-based.
Interesting. For Getopt::Long (that can take an optional
hashref as its first argument) I got explicit
* Shawn H Corey shawnhco...@gmail.com [2010-09-10 14:30]:
On 10-09-10 03:02 AM, Eric Wilhelm wrote:
sub foo {
my $self = shift;
my $self = shift @_;
Always put the array in the shift.
Why?
Regards,
--
Aristotle Pagaltzis // http://plasmasturm.org/
* Darren Chamberlain d...@sevenroot.org [2010-09-11 10:05]:
Template Toolkit (and several other modules) use this idiom:
sub new {
my $class = shift;
# allow hash ref as first argument, otherwise fold args into hash
my $config = defined $_[0] UNIVERSAL::isa($_[0], 'HASH') ?
On 10-09-12 04:58 PM, Aristotle Pagaltzis wrote:
* Shawn H Coreyshawnhco...@gmail.com [2010-09-10 14:30]:
On 10-09-10 03:02 AM, Eric Wilhelm wrote:
sub foo {
my $self = shift;
my $self = shift @_;
Always put the array in the shift.
Why?
Regards,
So you will never have
* Shawn H Corey shawnhco...@gmail.com [2010-09-12 23:15]:
So you will never have experienced Perl programmers come up to
you and ask, What does this shift do? It doesn't do anything;
@_ is not set yet.
Good Advice, #11905:
“Now is the time in our program where you look at the manual.”
# from Ovid
# on Thursday 09 September 2010 23:15:
sub foo {
my $self = shift;
my ($name) = @_;
...
I know this formatting is common, but what practical benefit does it
gain? ... I'm
unsure what value this provides other than conforming to a
particular coding preference (and it's
Eric Wilhelm enoba...@gmail.com writes:
So, say the first half of the innards of foo() are being refactored to
bar(), which will also take the original parameters in the same form:
sub foo {
my $self = shift;
my %bar = $self-bar(@_);
Don't forget SUPER:
sub foo {
my
On 10-09-10 03:02 AM, Eric Wilhelm wrote:
sub foo {
my $self = shift;
my $self = shift @_;
Always put the array in the shift.
--
Just my 0.0002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
The secret
17 matches
Mail list logo