Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Thoughts on new 'class' OO in upcoming perl

by hippo (Archbishop)
on Mar 06, 2023 at 12:09 UTC ( [id://11150775]=note: print w/replies, xml ) Need Help??


in reply to Thoughts on new 'class' OO in upcoming perl

But at this early stage, it seems to be only a copy of other programming languages, without the flexibility Perl can (and currently does) provide when it comes to object orientation.

Quite so. AFAICS that is rather the point - that this will be a gateway in for those more familiar with how such other languages do it. "See, Perl now has OO, just like python/ruby/lua/go/whatever!" and when the novice hits the limits of this new system they can then be introduced to the many other ways that Perl has for working with OO.

I don't see this new system as being aimed at experienced Perl programmers at all and there's no need for any of us to abandon what we currently use and migrate to it.


🦛

  • Comment on Re: Thoughts on new 'class' OO in upcoming perl

Replies are listed 'Best First'.
Re^2: Thoughts on new 'class' OO in upcoming perl
by cavac (Prior) on Mar 06, 2023 at 12:54 UTC

    and when the novice hits the limits of this new system they can then be introduced to the many other ways that Perl has for working with OO

    The problem with this approach might be that people will use it, hit that limit and complain loudly about the "very limited OO support in Perl".

    If 'class' would use the keyword "constructor" for a proper constructor method AND allow it to return undef, we'd be half there i think. And 'class' could just provide a default "new()" constructor if none if given.

    Stuff like "you can have multiple constructors" would be in the advanced section of the documentation, just like "multiple inheritance", "writing factories", and so on.

    If, say, i start a new project and get a newbie programmer sidekick, i would be forced to ban 'class' at the moment and force thew newbie to use bless() anyway. Simply because 'class' is too limited in scope and i would want to avoid a mixture of both in a project. Especially because those use a very different way of doing things and switching a module from 'class' to 'bless' would mean a very major rewrite.

    Which, BTW, is the other thing that feels totally wrong to me. Not only does it seem to be a bad idea to force potential rewrites of an entire OO project on future perl users when they exceed the "novice" levels, but it looks to me like a potential PR problem as well.

    As i said, if we really add another, "more modern" way of doing OO in Perl, it should be more powerful and "perlishly flexible" than what we already got, while at the same time easier to understand. With a few small changes, 'class' could be that solution.

    I'm not a big fan of the attitude of "optimize for beginners". I started programming using BASIC (on old Commodore machines). And i must say, it was kind of frustrating hitting the limits of the language, then having to throw away most of my knowledge and learn a completely different language. Yes, BASIC was "optimized" for beginners. But had Commodore given us a C compiler instead, it wouldn't have been a much steeper learning curve and there just wouldn't have been frustrating, artificial limits imposed by the language.

    In my opinion, the ability of a language should suffice for experts, but at the basics should be easy for novices to learn. Without limiting their ability to use already learned stuff later when they start to climb their ladder to become an expert.

    PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
Re^2: Thoughts on new 'class' OO in upcoming perl
by LanX (Saint) on Mar 06, 2023 at 12:34 UTC
    > when the novice hits the limits of this new system they can then be introduced to the many other ways that Perl has for working with OO

    Adding "Yet another incompatible OOP" system ? I'm skeptical ...

    Edit

    > "See, Perl now has OO, just like python/ruby/lua/go/whatever!"

    I dare say adding sub-signatures including named arguments to core would have a much bigger return of investment.

    Most beginners don't chose a language for their OO-system, they start fiddling around solving a minor problem and get stuck when they have fun instead of getting frustrated.

    Function signatures are a frustrating bumping stone.

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery

      I dare say adding sub-signatures including named arguments to core would have a much bigger return of investment.

      Thankfully, 5.36 provided sub-sigs. Ok, it's like the James Webb Space Telescope: A couple of decades late and way over budget. But now they are operational, both the JWST and sub-signatures turned out to be rather good. At least, from my point of view.

      PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2025-06-13 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.