Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: RFC: Concise OOP Syntax

by daxim (Curate)
on Aug 05, 2019 at 09:08 UTC ( [id://11103915]=note: print w/replies, xml ) Need Help??


in reply to RFC: Concise OOP Syntax

As I've told you several times, your assumptions [m]ost of us are stuck with an older version of Perl and [t]he crucial problem for the acceptance is backwards compatibility are just not true. (I don't know the name of the logical fallacy, but essentially you project your own position and circumstances onto everyone.) You burden yourself with a lot of work that is based on false premises and – if finished – is realistically useful only to a minuscule amount of users.

The rest can (and could for years) install Moops and get to enjoy superb class/roles/methods/types syntax sugar.

use Moops; use Data::Dx; class BLA extends SOME::PARENT with SOME::ROLE, ANOTHER::ROLE { has x => is => 'rw', isa => Int, writer => 'set_x', default => 10; has y => is => 'rw', isa => Int, writer => 'set_y', default => 11; method print_x() { printf "x = %s\n", $self->x; } method dump() { Dx $self; } } my $bla = BLA->new; $bla->set_x(42); $bla->print_x; $bla->dump;
If I had your skill and internals knowledge, I would improve Moops to add sugar for self-less attributes and less verbose attribute declarations.

Replies are listed 'Best First'.
Re^2: RFC: Concise OOP Syntax
by LanX (Saint) on Aug 05, 2019 at 09:43 UTC
    And I told you several times that I disagree.

    Thanks for the link mention of Moops, but it doesn't look like a syntax which will ever get into core.

    PS:

    > most of us are stuck with an older version

    never said this.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

    update

    https://metacpan.org/pod/Moops

    sigh ...

    > STATUS

    > Unstable.

    > Until version 1.000, stuff might change, but not without good reason.

        > You did, though.

        OK I did, but I meant something different.

        The full quote is

        > Most of us are stuck with an older version of Perl before the team decides to upgrade, so it would be very important for acceptance if the "sexy" syntax could already be run there.

        My job environment used to work with 5.16 until 1-2 years ago, we are now on 5.24 and may upgrade with the same cycle.

        The "halfbacked" OO model˛ I'm showing is a demo for my macro system which should already work with 5.8 or at least 5.10.

        I know of people who are stuck with 5.6 (AIX?) but "I never said" or meant to say that most of us are stuck with < 5.14 or something similar.

        (UPDATE: What I meant is that if we add a new OO syntax into Perl5, it would be a huge advantage if older versions (last 10 years?) could easily emulate it right away! )

        My approach of minimal dependencies is based on the assumption of

        • a tested and debugged technology because of long use
        • a safe fallback if a component of the (minimal) tool-chain fails
        • an appeal for module authors who want to address older versions °
        • maximum security that the features won't be deprecated soon
        • Last but not least: I lost faith into the operability P5P

        let me give you examples

        • has

        my TYPE $instance_var :has

        might look uglier in your eyes than

        has TYPE $instance_var

        But in the next step I could introduce a macro has which simply translates the later syntax into the former.

        That's a very simply transform:

        has TYPE $var REST -> my TYPE $var :has REST

        Or I like to use Keyword::Simple to activate macro SOMETHING but I love to be sure that I can always fall back to use macro SOMETHING if Lukas stops maintaining Keyword::Simple for whatever reason.

        I have big problems with all* these big projects which are "far ahead" by recombining many different technologies like Devel::XDeclare or was it Xdevel::Declare and meddle extremely with the parser.

        These are predisposed to have conflicts with other extensions and create possible maintenance nightmares.

        So these are my strategical thoughts.

        Saying this I'm irritated by your approach of trying to tell me that I rather have to work on other projects which don't follow my philosophy.

        To the degree that you participated at one of my talks about function signatures and criticized me for not knowing your favorite signature module. I did extensive research on 10+ other sig-modules on CPAN and nobody else in the audience seemed to have heard of your kafka-something.

        In short: my approach is technological yours is political.

        You want me to follow your agenda of reviving advanced but abandoned modules with huge dependencies chains.

        Sorry, wont happen ;-P

        footnotes

        °) If I remember correctly did Corion just write a source filter to support the experimental function signatures, just because he wanted his code to work with older versions.

        *) how many are there already???

        ˛) I'm very far from being a M[o[o[se]]] expert

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

        > I invite you to back up the extraordinary claims you make with the extraordinary evidence they deserve.

        > https://weblog.bulknews.net/perl-versions-usage-stats-with-cpanm-89c5f80fe91

        quote "In case you’re wondering: the big ones are 5.8.8, 5.10.1, 5.14.2 and 5.16.2."

        If I'm not wrong does this chart indicate that more than 50% of the users are on versions <=14.2.

        Please explain...

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

        update

        This stats are a brilliant source! thanks.

        But I think it would be even more interesting to get them from activestate too.*

        My colleagues "never" used cpan before and never heard of cpanm.

        Others might only use system Perl and their local package manager.

        I think it's a bit like polling for the average age of defloration - but only in a monastery. It's of limited use for the whole population.

        *) hmm ... there was a talk at YAPC::NA-2016 from an ActiveState guy ... -> ah here

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-03-28 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found