[pypy-dev] Re: Rtyping classes definitions?

Michael Hudson mwh at python.net
Tue Apr 4 23:52:46 CEST 2006


Antonio Cuni <anto.cuni at gmail.com> writes:

> Hi,
> I'm writing the code that generates CLI classes starting from
> ootypesystem classes definitions, but as always I have a problem :-).
>
> At the moment the only way to access class definitions is by calling
> TranslationContext.annotator.getuserclassdefinitions(), which returns
> a list of ClassDef instances: I've noticed that class attributes are
> not typed but only annotated.

Er.  Well.  I am almost entirely sure that your current approach of
(simplified):

    for graph in self.translator.graphs:
        f = Function(graph)
        f.render(self.ilasm)

is not really going to work.  Have you looked at how (say) genc works?
It first computes names for everything (the 'LowLevelDatabase'), and
then spits out the code.  'everything' includes all the types
referenced by the graphs, and because the graphs have been rtyped, the
types you find are things like instances of ootype.Class.

> Obviously for generating CLI classes I need to rtype class
> definitions, so that I can know the exact low-level type of the
> fields: I wondered if the absence of the rtyping step is intended or
> if it is a thing to do. In the latter case I could try to do it
> (hoping to do better than with rlist :-).

I'm not sure this question, as phrased, makes sense :)

Cheers,
mwh

-- 
  A witty saying proves nothing.                           -- Voltaire




More information about the Pypy-dev mailing list