![]() |
|
Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Thoughts on new 'class' OO in upcoming perlby kcott (Archbishop) |
on Mar 06, 2023 at 18:37 UTC ( [id://11150796]=note: print w/replies, xml ) | Need Help?? |
G'day cavac, ++ Thanks for this meditation. I was looking at class a week or two ago (when I first noticed v5.37.9 had been released). I had thought that I might install v5.37.9 to check it out (with actual code tests) but decided against that for two reasons:
"... i think this new system shouldn't give up any of the flexibilities ye olde 'bless' provides." Perhaps unintentionally, you have spoken (in various parts of your post) as if class was intended as a replacement for bless. As ++haj wrote: "bless isn't going to go away". Given "It [class] isn't a bless wrapper, but a completely new system built right into the perl interpreter."[perlclass: History], it would be interesting to benchmark bless-based and class-based new() functions. Currently, a class uses a '.../lib/Some/Class.pm' file which starts with 'package Some::Class;' (and, yes, I acknowledge that's an oversimplification). One of the things that I was interested in testing was whether simply changing 'package' to 'class' would still work in the current framework (e.g. @INC variable, parent pragma, 'SUPER' pseudoclass, and so on). The current documentation for class is extremely sparse. Given most of the documentation is in perlclass, the addition of a link to that should be a bare minimum. It does say that it "behaves similarly to package" but doesn't go into any detail beyond "... except that the newly-created package behaves as a class." — that strikes me as vague and terse, albeit accurate. — Ken
In Section
Meditations
|
|