[plt-scheme] Efficiency and automatic conversions

From: Daniel Silva (daniel.silva at gmail.com)
Date: Fri Nov 26 04:41:30 EST 2004

When you talk to other languages and have no compile-time type
information, how do you get rid of the following pyint->integer
without a big slow cond in the proxy class's generated methods?

(require (lib "class.ss")

(py-eval "
class myclass(object):
  def m(self, x):
    return x

(define py-myclass (in-python (ns-get 'myclass)))
(define myclass% (wrap-pyclass py-myclass))

(define obj (make-object myclass%))

(printf "obj.m(2) = ~a~n"
         (pyint->integer (send obj m 2)))


Posted on the users mailing list.