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

Re: Objects without stashes?

Thread Previous | Thread Next
Reini Urban
May 25, 2012 11:48
Re: Objects without stashes?
Message ID:
On Fri, May 25, 2012 at 1:17 PM, Leon Timmermans <> wrote:
> On Fri, May 25, 2012 at 5:41 PM, Aristotle Pagaltzis <> wrote:
>> How do things get into the vtable? What syntax is provided, how does it
>> interoperate or interact with the traditional approach of writing subs
>> in a package?
> I don't intend any current code to have different semantics, the
> default vtable will do the whole stashes dance the way we're used to.
> Other object implementations may have other ideas. For example a mop
> could use something simpler than the stashes-with-globs. Or maybe
> someone writes a nice prototype based OO system. Possibilities are
> endless.

Simplier? A MOP will always be more complicated and slower.
Our approach is always more general than the tighter OO systems in
other languages you are thinking of.

I see no big improvement, unless your method and fields vtable can be
pre-optimized to
indexed access instead of hash lookup at compile-time, for which we
lack syntax:
read-only packages, eg.
We have some optimization for field access since a decade. It was not
the break-through
improvement as rarely somebody uses it.

Please read Stevan's MOP notes on github.

Seperating subs from object methods and fields might be interesting
as they can be pre-optimized, but a conventional vtable makes no sense
with our dynamic perl.

It would have made sense if we had revamped our types and
used vtables for these, (int, string, classes...) which could be
extended to a new MOP.
But on the perl level it makes not much sense with our VM.
Stashes are the best implementation I foresee.

>> Do you break every single line of meta-programming code in
>> Perl ever written? Do you half break it? Or do you try somehow to make
>> this change transparent? How much does that limit you?
> Anything that uses the old behavior will keep working exactly the
> same. Though trying to use stash based introspection on non stash
> based objects wouldn't work obviously. I'm sure we can deal with that
> somehow, but that seems bike-shedding for now.
Reini Urban

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