[pypy-dev] Yet another trace tool!

Armin Rigo arigo at tunes.org
Sat Aug 28 18:46:40 CEST 2004


Hello Richard,

On Fri, Aug 27, 2004 at 04:12:14PM +0100, Richard Emslie wrote:
> inline Ref op_add(const BorrowedRef &x, const BorrowedRef &y) ...
> inline Ref op_add(int x, int y) ...
> inline Ref op_add(int x, const BorrowedRef &y) ...
> inline Ref op_add(const BorrowedRef &x, int y) ...
> // Same again but returning ints
> 
> but the problem IIRC c++ doesn't support overloaded return results.

Right, hence the idea to use the compile-time overloading and automatic
conversions.  op_add() would be defined only for two Ints returning an Int and
for two Refs returning a Ref.  Then if something else like "two Ints returning
a Ref" is needed, the C++ compiler will use the (Int, Int) version and convert
the result from Int to Ref automatically.  If something unsatisfiable is
needed, like (Ref, Ref -> Int), then it means that there is a problem with the
annotation phase.

> Ok.  Can you drop us a copy of genc.py which was doing something with the 
> annotations if that is ok (doesn't need to be any nice state)? Thanks.

I should have saved some intermediate results, but I wasn't on Internet so I
couldn't just check in my progress and now it's really in the middle of a
rewrite...  Give me some more time...


Armin



More information about the Pypy-dev mailing list