[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: perltoot barbie! (was Re: [FWP] do... while? SPOILER)



Adam Rice wrote:

> Quoting Randal L. Schwartz (merlyn@stonehenge.com):
> > I'm thinking of writing "Randal's Object Oriented Tutorial"
> > (perlroot.pod) based on a summary of what I'm now teaching in my OO
> > Perl class (and some of what I learned reading Damian's forthcoming
> > book), but sadly it will probably never make the standard Perl
> > distribution.
>
> I had to learn Java before I could understand Perl OO. Which made
>
> > sub new {
> >   my $this = shift; my $class = ref $this || $this; bless { @_ }, $class;
> > }
>
> all the more mindblowing. But now I've been using Perl OO for a few years,
> it seems strange to go back to languages where the constructor is a special
> case. I wonder if it's possible to have a statically-compiled language where
> constructors are ordinary static methods? Does such a beast exist?

I don't why it shouldn't be possible in a staticly-compiled language, but I've
never seen such a beast either.
But then again most languages are really fascist about this sort of thing.

> The disadvantage of Perl's flexibility here is when people abuse it, with
> strangely-named constructors (Tgetent in Term::Cap) or things like new2 (in
> LWPng). I guess natural selection prefers modules that don't waste a
> programmers time, though.
>
> > If I get some encouragement, I'll write perlroot.pod whether or not
> > it ends up in the dist.
>
> I'm all in favour of it, though I suspect it's too late for me.

Yes, Randal please please please write it. I may be too late for me too (but I
doubt it - for one thing I use constructors very much like the one above a lot).
Lots of my colleagues would really benefit from it. Persuading people that OO in
perl is a good thing, isn't exactly easy based on perltoot.

Does that count as encouragement?

TIA
Borup


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe