Apoc. 12 hasn't been released yet, and even then there is likely to be some changes between it and what is ultimately produced in the first stable version of Perl6.

I think it's important that when you talk about Perl5 objects, you need to speicify a little more. Usually, people are talking in terms of bless, but Perl5 has many other concepts which qualify as object systems that have nothing to do with bless, and some others that use bless in less traditional ways.

The bless object system is rather tacked on because of its implementation using references to common Perl types and the way it looks up methods. While there is no good way of implementing multiple inheirtance, Perl's method lookup is slow. Further, it's harder to enforce the interface because Perl lacks useful subroutine prototypes.

I was able to put some ideas I had about flexibilty onto firmer foundations when I read the ReiserFS whitepaper. It contains this axiom:

The flexibility of a system depends on the number of possible connections between components.

It goes on to say that you can increase the number of possible connections between components either by increasing the number of components or by increasing the number of components that know how to talk each other. For instance, any Unix program that knows how to write data to STDOUT can talk to any other Unix program that knows how to read data from STDIN (though it also has to have some understanding of what the data looks like).

To know how to talk to each other, each component needs an agreed upon way of talking to another component, i.e. a protocol. In terms of objects, the interface is your protocol. Break your interface, and suddenly components can't talk to each other anymore, and thus flexibility is reduced.

This is why, IMHO, having strict interfaces is actually a net increase for flexibility. Sure, your individual object might be less flexible, but by being loose with your implementation, you've made other parts of the system harder.

That's why I think Perl5's bless objects are so tacked on. The flexibility of implementation provides too many ways to break object privacy, thus breaking the interface, and thus making an overall less flexible system.

----
: () { :|:& };:

Note: All code is untested, unless otherwise stated


In reply to Re: perl6 & OO by hardburn
in thread perl6 & OO by chance

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.