finally i find a way to make the overload features of Scheme+ working in Kawa: -just by putting the necessary import-rename at the toplevel or in the used module as it does not works in macro -and adding the renamed existing operator/procedure as an extra parameter to the overloading definition macro: (require test-define) (import (rename (scheme base) (+ orig+))) (define-overload-existing-operator + orig+) (overload-existing-operator + vector-append (vector? vector?)) (define rv (+ #(1 2) #(3 4 5))) (newline) (display "rv=") (display rv) (newline) here is a running example with the updated source files in attachment: kawa -Dkawa.import.path=".:/Users/mattei/Library/Mobile Documents/com~apple~CloudDocs/Scheme-PLUS-for-Kawa" #|kawa:1|# (load "main-test-define.scm") proc =# orig-proc =# rv=#(1 2 3 4 5) #|kawa:2|# (+ 2 3) 5 #|kawa:3|# (+ 2 3 4) 9 #|kawa:4|# (+ #(1 2) #(3) #(4 5)) #(1 2 3 4 5) you will notice that it works with + even as an n-arity operator because operator are associative and overloaded procedure take care to apply associativeness. This also could be done with Kawa support for multi-method i suppose by using my code in the defined method, this was my primary idea before finding this little hack to adapt for Kawa my already written Scheme+ algorithm for overloading. Damien On Sat, Nov 4, 2023 at 12:48 AM Damien Mattei wrote: > > On Fri, Nov 3, 2023 at 7:29 PM Per Bothner wrote: > > > First, I think using + for vector-append is a bad idea. > not part to be always defined like that > > It's questionable for strings, but if + on vectors would be > > better to mean vector addition - i.e. mapping + element-by-element. > just to port from Python a test example as in python + is used to append vectors > > (Of course my exposure to APL is influencing me here.) > :-) > > > > Second, Kawa has some half-assed support for "multi-methods": > > https://www.gnu.org/software/kawa/Generic-procedures.html > > That could be enhanced. > sounds great, a fast test give good results: > #|kawa:1|# (import (rename (scheme base) (+ orig+))) > #|kawa:4|# (define + (make-procedure method: (lambda (x ::number y > ::number) (orig+ x y)) > #|.....5|# method: (lambda (x ::vector y ::vector) (vector-append x y)))) > #|kawa:6|# (+ 2 3) > 5 > #|kawa:7|# (+ #(1 2) #(3 4 5)) > #(1 2 3 4 5) > could be enhanced for associative n-arity operator of course, the way > i did it in overload procedures > Damien