Hi Joe, > 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)) Unfortunately, no. That's current not possible because the compiler always box/tag values returned from closure, and methods attached to generic functions are closures.
I agree that this is really unfortunate but as I said there is no immediate solution. Do you absolutely need signed int64 for srfi25? As a temporary work around can you go along with simple "long" as there is (almost) no cost for tagging/untagging them? If you are using these values to index arrays, using a 61-bit wide number should be enough, no? -- Manuel
