develooper Front page | perl.perl5.porters | Postings from July 2022

Re: 'class' feature has begun / initial tidying PRs

Thread Previous | Thread Next
Paul "LeoNerd" Evans
July 5, 2022 10:14
Re: 'class' feature has begun / initial tidying PRs
Message ID:
On Tue, 5 Jul 2022 10:17:15 +0100
Dave Mitchell <> wrote:

> On Thu, Jun 30, 2022 at 07:08:16PM +0100, Paul "LeoNerd" Evans wrote:
> > I've just started the implementation of `use feature 'class'`. I
> > thought I'd let people know this, and also draw attention to some
> > tidying-up PRs I've created in the process.  
> Where is the best place to read up what the proposed new feature will
> look like? I may well have missed earlier p5p or RFC discussions.

The overall RFC formed from the Corinna spec lives at

  (It's split into sections; you'll want to start at `` and use
  the "Next/Prev" navigation links inside it)

Overall that describes quite a large concept. We attempted to break it
down into a smaller set of steps, that could be incrementally added to
perl core one at a time. I may have written about these "publicly" but
offhand I can't recall where a list might be, so here from my
sponsorship proposal:

  1. Initial `use feature 'class'` to add basic class/field/method.
     ADJUST blocks.
     No roles, no class/field/method attrs, no MOP.
  2. Class inheritance - class :isa() attr
  3. Roles, and class/role :does() attr
       -- still some design thoughts to be had on `requires`
  4. Various "convenience" attributes -
       field :reader :writer :accessor :mutator
       field :weak
       field :param
       method :overrides()
  5. Field initialiser blocks
  6. MOP
  7. Method modifiers (`around method` or however it might be spelled.
       again more design work still needed here)

As another option, there's my Object::Pad module, which could be
considered as an experimental implementation of the Corinna spec:

It has a bunch more besides, trying to push beyond what's in Corinna by
implementing what's been found to be actually useful in practice,
because we've been actually using it for real in real modules:

(plus a *tonne* more stuff that isn't on CPAN because it's internal
production code at various companies I contract for)

It also contains a bunch of "historic mistakes"; artefacts of early
design that are still in use "in the wild" so can't just be deleted as
easily as they can from the paper-spec of Corinna itself. Things like
`BUILD` blocks and the older `slot` name for what Corinna now calls
`field`. It occurs to me perhaps I should draw attention to those bits
in the docs; especially as I'm about to start writing the
Feature::Compat::Class wrapper module for using O:P or core. Hmm...

I'll also clarify that all of the above are intended to be the
"Perl-programmer facing interface" part of the design. Until I actually
started implementing the thing, I don't think anyone had really put any
thought into the internals of how it would all work inside.

I've started keeping some "notes to self" on that latter subject in the
github "discussions" section of my own perl5 repo:

Paul "LeoNerd" Evans      |  |

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About