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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.