DEV Community

Discussion on: Bringing Modern OO To Perl

Collapse
 
mmcclenn profile image
Michael McClennen • Edited

I like this! I think you are on the right track. And I agree 100% that the proper goal is to produce a better OO language than any available today. Perl has been falling behind the curve for too long now, and if we are going to revitalize the community we need to be jumping ahead rather than catching up.

The one part of the specification that worries me so far is that slot variables defined after the last :new slot variable in a class will be undefined when CONSTRUCT is called. It seems to me that "the last :new slot variable" is going to be a difficult thing to keep track of in large class definitions, where developers may be adding and removing :new from various declaration lines as development proceeds.

I suggest instead an additional attribute :after, such that slot variables with this attribute will not be defined until after CONSTRUCT is called. All other slot variables will be defined before CONSTRUCT is called, in the order defined. Specifying this explicitly rather than positionally will, I think, avoid a lot of confusion.

Collapse
 
ovid profile image
Ovid

Since this was posted, we've had a lot of discussion around CONSTRUCT and have since realized that as a phaser, it actually doesn't work since it needs to return a value. So we dropped it entirely. Now, we just use alternate constructors if we need to munge the arguments, or do validation in the ADJUST phaser.

Collapse
 
mmcclenn profile image
Michael McClennen

Good, the implementation of CONSTRUCT as proposted on the current Wiki page bothered me a great deal. I agree that dropping it was a good choice. Can you point me to where these discussions are going on? I'd love to follow along and give my input where warranted.

Thread Thread
 
ovid profile image
Ovid

Largely they're on irc.perl.org on the #cor channel. Mostly it's pretty quiet right now because we've nailed down much of the behavior and the push to get the next version of Perl out the door is taking priority.