4 ms·
"We're determined to have improved OO syntax in a future release, and we'd love that to be v8, but we don't want to hold up this plan because OO needs time to m
by tyingq 6y ago
"We're determined to have improved OO syntax in a future release, and we'd love that to be v8, but we don't want to hold up this plan because OO needs time to mature."
I wonder what this means. Especially if signatures are on by default, the OO syntax is pretty straightforward already, with most boilerplate gone. Like:
package Some::Object {
sub new ( $class, $args = {} ) {
bless $args, $class;
}
}
- chrisseaton 6y ago> with most boilerplant gone Boilerplate class variable, boilerplate args variable, both written twice, deliberately cryptic whimsical 'bless' operation that for some reason needs to be done manually. Come on...
- tyingq 6y agoThe boilerplate class and args aren't mandatory, @_ still exists. I put them in the example to mean that if you wanted to use them, you don't have to pull them out of @_ with boilerplate. As for bless(), it's what makes Perl OO work. Getting rid of it is an option, but to me getting rid of it makes things more cryptic.
- chrisseaton 6y ago> As for bless(), it's what makes Perl OO work. Getting rid of it is an option, but to me getting rid of it makes things more cryptic. Yeah I get it... but it's still boilerplate. Something you have to write out manually each time which you don't need to do in other languages.
- tyingq 6y agoYes, but it is significantly less boilerplate than before. If you get rid of bless(), you would need to add some equivalent to "package" that is OO specific rather than just namespaces, and/or a magical constructor method name. That (to me) is no less whimsical than bless.
- eCa 6y agoI would guess something that allows defining classes in a way that resembles Moo or Moose.
- clscott 6y agoThis is the current proposal (it's a living document). For example it was just decided to drop the CONSTRUCT phaser and likely the common keyword. https://github.com/Ovid/Cor/wiki/Corinna-Overview https://github.com/Ovid/Cor/wiki/Corinna-Overview This is an implementation of some of the ideas that is proving out to be faster (execution wise) than hash based objects: * https://metacpan.org/pod/Object::Pad https://metacpan.org/pod/Object::Pad