user-pic

dakkar

  • Commented on I think subroutine signatures don't need arguments count checking
    If you don't want the runtime to check for argument count, you can say: sub foo($x,$y,@) { ... } and the "too many arguments" check won't be compiled (I just checked with B::Concise)....
  • Commented on A small puzzle for you
    #!/usr/bin/env perl use strict; use warnings; use List::AllUtils 'uniq'; use Data::Printer; sub align { my @all_values = sort(uniq(map {@$_} @_)); for my $param (@_) { my %hash;@hash{@$param}=@$param; @$param = @hash{@all_values}; } return; } my @a = ( 'b', 'c',...
  • Commented on I hate Dist::Zilla and missing Makefile.PL
    Yep. That's why I use the Git::CommitBuild plugin, to give you both https://github.com/dakkar/Net-Stomp-MooseHelpers/tree/v2.1-dzilla (what I write) and https://github.com/dakkar/Net-Stomp-MooseHelpers/tree/v2.1 (what you can use without dzil). This way, anyone can send me patches for whichever version they're most confortable with, and I...
  • Commented on Keeping a Reasonable Number of Incremental Backups
    That looks very much like http://www.rsnapshot.org/ I've been using it for years and it's very very simple....
  • Commented on I try postderef and key-value slice in Perl 5.19.5
    That's not the way ->%{} is supposed to work. $a->%{foo} returns foo => $a->{foo}, and you can't assign to such a thing. You probably meant $new_params->@{'FOO', 'BAR'} = $params->@{'foo', 'bar'};, which does the assignment you're looking for....
  • Commented on A feed reader
    It would not be particularly complicated to get Feeder to send email instead of writing to a maildir: you just write a role to do that. It would be like Feed::Role::MailDir, but instead of using Maildir::Lite, it would directly send...
Subscribe to feed Recent Actions from dakkar

  • Yuki Kimoto commented on I think subroutine signatures don't need arguments count checking

    Salvador Fandiño

    I didn't do benchmark.

    but logically run-time checking is one cost. string checking is not bad, but it is bad that the behavior is default.

    Perl is dynamic language, so default behavior should be dynamic one.

    For example, the following behavior is good.

    sub foo ($x, $y) {
    ...
    }
    # Same as
    sub foo {
    my ($x, $y) = @_;
    }

    sub foo ($x, $y) : strict {

    }
    # same as
    sub foo {
    die if @_ != 2;
    my ($x, $y) = @_;

  • Yuki Kimoto commented on I think subroutine signatures don't need arguments count checking

    >I think argument checks are a good thing because correctness is more important than speed (who cares how fast you are at getting the wrong result?).

    >Checking the arguments manually is annoying boilerplate code that no user wants to bother with. It's much better to be able to abstract it away and have the language do it for you automatically.

    Perl is dynamic language. Argument count checking should be optional. Logically run-time checking is one performance cost. In static language, arugument count checking can be done in compile-time, but in dynamic lanugage, it is done in …

  • Yuki Kimoto commented on I think subroutine signatures don't need arguments count checking

    I assume javascript function.

    function foo(x, y) {

    }

    foo(1) // ok
    foo(1, 2) // ok
    foo(1, 2, 3) // ok

    Perl should implement javascript subroutine signatures at first step.

  • Yuki Kimoto commented on I think subroutine signatures don't need arguments count checking

    and PHP

    function foo($x, $y) {

    }

    foo(1) // ok
    foo(1, 2) // ok
    foo(1, 2, 3) // ok

    I like JavaScript and PHP way. This is natural.

  • weissel commented on I think subroutine signatures don't need arguments count checking

    Hmmm.

    Yuki, you seem to have a strong opinion here.
    Not that there is anything wrong with having strong opinions --- but it would be much better if you could at least point to some facts that support your opinion.
    Like, say, benchmarks. Like, say, code (show the source code!) that does run appreciably faster without argument checking.

    Performance at all costs of programmer usability, maintenance and bug finding ease would mean that you write highly optimized, hand-polished assembler running on the bare metal of the machine, with no OS to slow things down…

Subscribe to feed Responses to Comments from dakkar

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.