Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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).


In reply to Re: Cor—An object system for the Perl core by Arunbear
in thread Cor—An object system for the Perl core by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2024-04-16 08:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found