develooper Front page | perl.perl5.porters | Postings from July 2012

Re: Objects without stashes?

Thread Previous | Thread Next
Rev. Chip
July 13, 2012 14:25
Re: Objects without stashes?
Message ID:
On Thu, Jul 12, 2012 at 10:43:01PM -0500, Jesse Luehrs wrote:
> On Thu, Jul 12, 2012 at 08:09:31PM -0700, Rev. Chip wrote:
> > On Fri, May 25, 2012 at 04:47:17PM +0200, Leon Timmermans wrote:
> > > I hate the way classes/objects work. In particular, I think stashes of
> > > globs of other stuff is paradigm that fails ...
> > 
> > At the micro change level, how about just allowing arbitrary hash refs as
> > stashes?  Seems like any self-respecting MOP would need that anyway, and
> > it's a useful feature for anyone doing mixins.
> On the one hand, any implementation of a MOP that actually works well is
> not going to have any interaction with stashes at all (the indirection
> of going through typeglobs is unnecessary and just slows things down and
> complicates things for no reason - all MOP-based classes would need is a
> map of methods).

I didn't use the term "stash" or "glob", and that was on purpose.  I would
like to see this work, where the RHS of bless is a simple hash that stays

    bless [0], { inc => sub { ++$_[0][0] },
                 dec => sub { --$_[0][0] },
		 DESTROY => sub { print "BYE\n" } };

and I don't see why that isn't both easy and helpful today, even before
p5-mop is ready.  Supporting overloading might be tricky if it's not a
stash, I'll grant you, but I'm sure it's feasible.
Chip Salzenberg

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About