http://qs321.pair.com?node_id=11146337


in reply to What if Perl had an OO standard library?

I much prefer the option to create either an object orientated distribution, or a non-oo one.

If I don't need to keep any state, why bother with the added complexity? OO adds overhead, no matter how slight.

Among my list of familiar languages, Python is one. Python is "everything is an object". I'm a guy who prefers simplicity, and freedom to choose. If I want to create a list of functions for very basic mathematical calculations purely written in C fronted by Perl with no OO overhead, I like that choice. If I want to represent a Tesla vehicle that has thousands of always-changing parameters that requires a mechanism to maintain that state, I want that choice. When I want to wrap another language's API where I want to provide both a procedural and an OO interface, I want that choice. I feel that everything is an object is a bit overkill. That's why I didn't diverge with the then Perl6 crowd (in fairness, I did give it a very good run to be certain though).

Important part is the availability to choose. Even when I do write OO distributions (most of mine are), I don't use anything but the core perl OO functionality. No Moose or equivalents etc. Even when Corinna comes into play, I very much doubt I'll change my ways.

  • Comment on Re: What if Perl had an OO standard library?

Replies are listed 'Best First'.
Re^2: What if Perl had an OO standard library?
by tobyink (Canon) on Aug 27, 2022 at 19:39 UTC

    "Even when I do write OO distributions (most of mine are), I don't use anything but the core perl OO functionality"

    Is this because you dislike the Moose-like syntax, because of speed concerns, or because you don't want to create dependencies on non-core modules for end users.

    If it's because of speed or dependencies, you should look at Mite. Mite allows you to write Moose-like code, "compile" it on your machine into plain Perl, and distribute the compiled result so your end users don't need any non-core modules.