Please review the following, if you will:
package TestAnonBefore; use 5.008; use strict; use warnings; use PerlPlusPlus (__PACKAGE__); # ,instance =>'$self'); # $priv_ is optional, $priv_foo is private and will have a private get +ter/setter for this package only # $priv_foo can also be accessed as '$priv_foo' # # $pub_bar is public and will have a public $self->bar getter/setter # # $prot_baz is protected and will have a $self->bar getter/setter only + for subclasses # my($self,$priv_foo,$pub_bar,$prot_baz); # my($self); # can declare $self separately # When sub matches package name, it is constructor # implicit access to $self sub TestAnonBefore { ($pub_bar)=@_; # that's it... } # public instance method, not a getter/setter # getters/setters are generated automatically based on scope (private, +protected,public) sub do_stuff : PUBLIC { $self->do_private; 'Private: ' . $self->foo . ' Public: ' . $self->bar . ' Protected: + ' . $self->baz; # is equivalent to: 'Private: ' . $priv_foo . ' Public: ' . $pub_bar . ' Protected: ' +. $prot_baz; } # sub do_private :Private { sub do_private : PRIVATE { $priv_foo++; } sub stuff{ # same as PUBLIC print "123\n"; } # done declaring a class with PerlPlusPlus no PerlPlusPlus; 1;
Looks familiar to some, and utterly alien to others. What I'm wondering is, is this even a good idea? If someone were to implement a superset of Perl that would obviate the need for
my($self)=@_;
would anyone like/use it? If so, is the preceeding acceptable? What changes would YOU make?? Thanks!

2006-04-08 Retitled by planetscape, as per Monastery guidelines
Original title: 'PerlPlusPlus'


In reply to RFC: PerlPlusPlus - Better OO by Anonymous Monk

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.