Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^10: Amicable divorce

by LanX (Saint)
on Jul 12, 2020 at 17:43 UTC ( [id://11119232]=note: print w/replies, xml ) Need Help??


in reply to Re^9: Amicable divorce
in thread Amicable divorce

> 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:

  • first implementing a slow but light-weight backwards compatible variant
  • than implementing a fast XS variant on the same syntax and semantics
  • after a phase of proven experimental feature integrating it into the core language.
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

Replies are listed 'Best First'.
Re^11: Amicable divorce
by ribasushi (Pilgrim) on Jul 12, 2020 at 18:05 UTC
    > Does this fit into your requirements

    Absolutely not. My requirements are simple:

    Then maybe (and that is a huge maybe) I may reevaluate if something new is worth writing under /usr/bin/perl again. Today the answer is a resounding "fuck no".

    P.S. Golang the language (syntax-wise) is almost as shitty, and in places way shittier than Perl. Syntax is sugar: I have no problem copy-pasting code like an animal, provided my programs works, can push the resources I have to the max, and will continue doing so for decades.

    P.P.S. You really should not care what I think: I have not been paid to write perl since 2018, and I am unlikely to do so in the future. Perl work on a resume is a liability these days, unless you are happy with booking-level pay. I am decidedly not your target demographic.

      > Stop fucking around with syntax. If someone (including you) wants a new way to express the same thing, but shorter, they should pay the XS tax, not my userbase.

      I don't get it,

      • I showed two PP solutions ²
      • XS is a voluntary intermediate step to speed up (I can't hack C anyway°)
      • and if a feature is later included into a newer core, then syntax and semantics would stay the same.
      In short: It runs on 20 year old Perl versions just slower.

      ¯\_(ツ)_/¯

      PS: How do I pay the XS tax? Invoice or credit card?

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

      °) I'm fucking around, tho ...

      update

      ²) wait, autobox does indeed require XS (I think it's overloading the -> operator)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11119232]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-03-29 02:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found