ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> language-dev
language-dev
Re: vtable.h
by Simon Cozens other posts by this author
Oct 6 2001 1:47PM messages near this date
[barry@zope.com: [Python-Dev] RELEASED: Python 2.2b1 is out!] | Re: vtable.h
On Sat, Oct 06, 2001 at 08:24:46AM -0500, Gibbs Tanton - tgibbs wrote:
>  1.) Will each different "type" of PMC have its own vtable, function
>  definitions, etc or will they all share everything with switches on type in
>  the function definitions.

They'll each have their own, to make overloading possible.

>  2.) Can you give an idea of what you think the macro-ized function should
>  look like (an example would be great.)

No, because then you'll go away and implement it, and I want to encourage
some fresh blood to do that. :) 

Seriously, before I do that, I need to seriously think about what vtable
accessors ought to look like;

    (pmc1-> vtable[want_vtbl_add])(pmc1, pmc2, pmc3)

is going to scare people away quickly, and, while

    PMC_ADD(pmc1, pmc2, pmc3) 

is cute, (and allows us to autogenerate Parrot byte ops ;) Macro
Hell is something we want to avoid. 

For comparison, Python does stuff long-hand:

    if (v-> ob_type == w->ob_type
        && (f = v-> ob_type->tp_compare) != NULL)
        return (*f)(v, w);

so maybe it's not that bad. (In fact, look in Object/abstract.c for how
Python handles PMC vtable functions, uh, I mean, PyObject method calls.)
It's certainly easiest to understand, although the abstraction in
abstract.c might cost some running time. Or it might not. I always seem
to work on the assumption that "function calls are always very costly",
but that might not be true these days.

Sounds like a language-dev question; how best to handle method despatch
on objects in C? Is it *really* a maintainability-speed trade-off?

-- 
The angels want to wear my red shoes.
Thread:
Simon Cozens
Mathieu Bouchard
Mathieu Bouchard
Brent Dax
Dan Sugalski
Thomas Wouters
Dan Sugalski
Dan Sugalski
Brent Dax
Brent Dax

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved