duplicate version reference - was #<syntax (scheme base) in #61>
Damien Mattei
damien.mattei@gmail.com
Fri Nov 3 17:57:39 GMT 2023
i understand. For my overloading operator idea, do you think is it
possible in Kawa (like in guile: (define-method (+ (x <vector>) (y
<vector>)) (vector-append x y)) ),using the class and defining method
to overload some operators like + ,* ,etc ? and even do it for basic
type like vectors? allowing the use of + instead of vector-append?
On Fri, Nov 3, 2023 at 6:35 PM Per Bothner <per@bothner.com> wrote:
>
>
>
> On 11/3/23 10:25, Damien Mattei via Kawa wrote:
> > but if i put the statement in a macro, it no more works:
> > kawa -Dkawa.import.path="."
> > #|kawa:1|# (define-syntax define-overload-existing-operator
> > #|.....2|#
> > #|.....3|# (syntax-rules ()
> > #|.....4|#
> > #|.....5|# ((_ proc) (import (rename (scheme base) (proc orig-proc))))))
> > #|kawa:6|# (define-overload-existing-operator +)
> > /dev/tty:6:1: duplicate version reference - was #<syntax (scheme base) in #61>
> > /dev/tty:6:1: unknown library (#<syntax#3 rename in #61>)
>
> To start with, orig-proc is undefined. proc and orig-proc are completely unrelated identifiers.
>
> Generating a new identifier orig-proc based on an existing identifier proc
> is possible (using syntax->datum and datum->syntax) but it's tricky.
>
> Using import in a macro expansion may have some issues or bugs
> I haven't really thought about, at least not in a long time.
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
More information about the Kawa
mailing list