Subject: bug#70534: eval-string: wrong environment for compilation

From: Nikita Domnitskii <[email-masked]>
Date: Tue, 23 Apr 2024 17:07:02 +0600

Hi!

I'm pretty sure there is a bug in (ice-9 eval-string) implementation.

If #:compile? is true it doesn't pass current module to the
read-and-compile procedure which in my opinion leads to undesired
behavior:
This code snippet doesn't work
--8<---------------cut here---------------start------------->8---
(let ((module (current-module)))
  ((@ (ice-9 eval-string) eval-string)
   "(define-syntax-rule (comment . _) #f)"
   #:module module
   #:compile? #t)
  ((@ (ice-9 eval-string) eval-string)
   "(comment 1 2 3)"
   #:module module
   #:compile? #t))
--8<---------------cut here---------------end--------------->8---

While this one does
--8<---------------cut here---------------start------------->8---
(let ((module (current-module)))
  ((@ (ice-9 eval-string) eval-string)
   "(define-syntax-rule (comment . _) #f) (comment 1 2 3)"
   #:module module
   #:compile? #t))
--8<---------------cut here---------------end--------------->8---

Fix should be pretty easy. Let me know if it's indeed unintended and
I'll send the patch

-- 
Best Regards,
Nikita Domnitskii