> Named arguments, default values, parameter checking are all syntactic sugar, which sure, is somewhat nice to have, but is no possible way essential.

I remember a talk from Damian from YAPC 2011 or 2012 showing the benefits of porting to Perl 6.

The thing that stuck the most was when he showed how his subs shrank 30-50% only by using function signatures with parameter checking.

> Every time you go "I can do this using this little longer syntax" - you already disqualified it as a "long overdue must have feature".

Sorry it's not a little longer syntax, and training new programmers in how best to unpack @_ is a PITA.

But, what's your concern here?

That the syntax won't work on older Perl-versions???

FWIW: It's possible to implement it with syntactic sugar in pure Perl without any XS, but the syntax would require at least one new sub args() which is called to unpack @_

sub foo { args my $x, my $y ="default", name => my $name ="def2"; ... #body }

When using Keyword::Simple this would also come without speed penalty, because args would be evaluated at compile time.

Is that acceptable for you???

> This is something I had to write 2 months ago.

I'm no Go-go-boy , no idea what that means.

> But sure, let's talk about signatures and postfix-deref 🤮

I'm not fond about postfix-deref tho I'd avoid this emoji when criticizing other peoples work.

But I'm a big fan of autobox which is backwards compatible.

Something like $HoA{key}->push(1,2,3); is more readable than push @{$HoA{key}},1,2,3; , not only to beginners.

Problem is that Autobox comes with a speed penalty, because ->push triggers a method lookup in a wrapper class for arrays (or undef scalars)

A fast implementation would need to create Op-Codes for certain "special" methods like ->push or '->shift'.

If the LHS is an array it would just execute the code for push() and 'shift()', etc without performance lost.

Otherwise they would fall back to normal method lookup for objects.

That's the way I would go for newer features:

Does this fit into your requirements, or do you still think Perl core should be frozen?

PS: I'm using // nearly every day...

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery


In reply to Re^10: Amicable divorce by LanX
in thread Amicable divorce by ribasushi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.