Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Cor—An object system for the Perl core

by Arunbear (Prior)
on May 20, 2020 at 15:52 UTC ( #11116992=note: print w/replies, xml ) Need Help??

in reply to Cor—An object system for the Perl core

From the wiki:
Cor must be better than what you can get in Python 3, Ruby, Swift, and so on.
That would be really nice (and I do appreciate the effort put into this), but some reasons I think it falls short of being truly better:

1. No autoboxing. What if you'd used a plain hash instead of Hash::Ordered? In Python/Ruby e.g. it's nice that when dealing with hashes and arrays you can call methods on them so there isn't the kind of mental switching between OO and procedural that we must do in Perl.

2. Lack of uniformity between built in containers and user defined ones. In the Hash::Ordered docs there is this snippet:

$oh->add( 'a', 5 ); # like $oh{a} += 5 $oh->concat( 'a', 'hello' ); # like $oh{a} .= 'hello'
I don't get the impression Cor would actually let both of those work. Whereas in Python this would look like:
>>> h = {'a' : 1} >>> h['a'] += 2 >>> h {'a': 3} >>> >>> from collections import OrderedDict >>> oh = OrderedDict(h) >>> oh OrderedDict([('a', 3)]) >>> oh['a'] += 2 >>> oh OrderedDict([('a', 5)]) >>> oh['b'] = 'hello' >>> oh['b'] += ' world' >>> oh OrderedDict([('a', 5), ('b', 'hello world')])

3. We're still conflating interfaces and implementations (surely we can do better?). I'd really wish class definitions to be more self documenting so I can first get an overview of what it does, and then focus on the "how". FWIW, I did a proof of concept of what this could be like. So e.g. the first thing you see is the "what" which can be more rich than just a list of methods (contracts in fact).

Replies are listed 'Best First'.
Re^2: Cor—An object system for the Perl core
by Ovid (Cardinal) on May 20, 2020 at 21:33 UTC

    Maybe we'll do autoboxing later (I doubt it, but who knows?), but that falls outside the scope of an MVP.

    As for your other points, maybe join the IRC channel? Some of your points come down to different opinions about how to define and approach correctness and that's often very subjective.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11116992]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (None)
    As of 2022-01-26 06:15 GMT
    Find Nodes?
      Voting Booth?
      In 2022, my preferred method to securely store passwords is:

      Results (69 votes). Check out past polls.