Generic Function Question

Joseph Donaldson <[email protected]> Fri, 1 May 2020 16:11:23 +0000 (UTC)
Newsgroups gmane.lisp.scheme.bigloo
Message-ID <[email protected]>
Hello,
While implementing srfi25 for bigloo, I experimented with using generic functions for the api and noticed that although you can have generics return non-bigloo types such as int64 the methods defined for that generic function always return boxed values. This is not a problem from a correctness perspective but it is a performance issue. For example in my scenario, the method was computing an int64 boxing it and then returning it to the generic function dispatcher which immediately unboxed it. Is there a way to remove this boxing/unboxing overhead?
A very simple example demonstrating this is below.

(module example   (export         (generic test o::base i::long)  
       (class base)       (class deriv::base))
   (main main))

(define-generic (test::int64 o::base i::long))
(define-method (test::int64 o::deriv i::long)    #s64:0)
(define (main args)    (print "result: " (test (instantiate::deriv) 0))

Thank You,Joe