[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug report: compiling macrolet with defun inside
From: |
Camm Maguire |
Subject: |
Re: Bug report: compiling macrolet with defun inside |
Date: |
Sun, 06 Apr 2025 17:16:26 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Greetings, and thank you so much for your report!
I've pushed a fix to git branch gnu-build-system, which will appear in
release 2.7.0 shortly.
Take care,
David Scherfgen <d.scherfgen@googlemail.com> writes:
> Dear GCL developers,
>
> Here's another bug(?) I encountered.
>
> The following code works correctly when entering it directly into the REPL.
> But compiling it doesn't work correctly.
>
> Place this in a file bug.lisp:
>
> (macrolet ((impl (op) `(,op x y)))
> (defun add (x y) (impl +)))
>
> This defines a function add (x y) with the body (+ x y).
> Compile it:
>
> (compile-file "bug.lisp")
>
> The compiler gives some warnings that already indicate that something is
> wrong:
>
> ; (DEFUN ADD ...) is being compiled.
> ;; Warning: The variable X is not used.
> ;; Warning: The variable Y is not used.
>
> Load the compiled file and try to call add:
>
> (load "bug.o")
> (add 3 4)
>
> The following error is shown:
>
> Condition in ADD [or a callee]: INTERNAL-SIMPLE-TYPE-ERROR: IMPL is not of
> type FUNCTION:
>
> The compiler failed to expand the impl macro and treated it like a function!
>
> Tested with GCL 2.6.14.
>
> Best regards
> David Scherfgen
>
--
Camm Maguire camm@maguirefamily.org
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah