Exactly. I'd like methods give compile errors if their arguments if they are the wrong type. Even using mechanisms like strict, etc, Perl is a little dangerous when it comes to OO syntax. When I'm writing a straightforward non-OO app, this is fine, and I can deal with it, but when I really want objects, I want Perl to understand them and enforce them, rather than allowing them to be scalars. I think this could be accomodated for in the oft-unused Perl message-signature feature, which right now only takes basic types.

Also, it's really odd what determines when a class has a certain method. For instance, if I have a "$program->run" and a "$dog->run" I don't want to be able to call $foo->run() and have it work with both dogs and programs. I want method overloading. I want cleaner inheritance and things like "super()". I'd like to be able to specify virtuality and non-virtuality.

Having a dog run and a program run? This does not make sense. Chewbacca lives on Endor, and this does not make sense. Therefore we must have more strongly-checked OO.

I started my OO life learning C++ and Java, grew to love Java, grew to hate Java, but it wouldn't be bad if Perl became a little more mainstream in it's OO. Just don't repeat Java's failings -- inconsistant API, lack of multiple inheritance, exception hell, etc. Perl already has a leg up since it has a much stronger base library -- so a little cleaner OO syntax to go with that library, that would be great.

My only OO heresy is that I despise "getter and setter" methods. Maybe that's not heresy, maybe those methods are against the spirit of message passing (I think they are). Anyhow, Perl doesn't have to mandate style as far as java does, where a programmer is cast down for making a public variable. It should, however, start to treat objects as though they have types.


In reply to Re: Re: perl6 & OO by flyingmoose
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.