[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] Inconsistent global/local :var assignments in ob-* for lisps a

From: Ihor Radchenko
Subject: Re: [BUG] Inconsistent global/local :var assignments in ob-* for lisps and non-lisps (was: org-babel guile source block bug in handling multiple values)
Date: Sat, 11 Mar 2023 09:58:21 +0000

Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:

> The issue is not with defining via (define ...) inside a (let ...) in Guile. 
> It 
> is about importing macros at the time, when the body of the (let ...) is 
> already 
> evaluated, which is at a later phase than macro expansion. By wrapping inside 
> a 
> (let ...) org has moved the import to a later phase, which causes the macro 
> (let-values ...) to not be expanded.

I see.
AFAIK, Elisp does not have this problem.

> As far as I know, (defun ...) and (defvar ...) are merely defining functions 
> and 
> variables, not macros.

Same for defmacro in Elisp.

> My point is, that imports are usually global for sessions. But :var decided 
> for 
> let-wrapping, moving them to a different place. Just like imports are usually 
> global, I would expect (define ...)s to be global in the session, unless I 
> put 
> them inside a narrowed scope like a (let ...) myself. The org generated (let 
> ...) is invisible to the user and thus confusing, at least for GNU Guile.
> For other Schemes it probably all depends on how their phases of expansion 
> and 
> evaluation work. I don't know enough about the Scheme standards, to tell, 
> whether Guile has the correct behavior here or whether there is a correct 
> behavior defined in the Scheme standards. Maybe someone more knowledgeable 
> can 
> chime in to comment on that.

When saying Guile I mean scheme. Remember that I am now looking from a
more general perspective of other ob-* libraries.

My conclusion so far is that it is not safe in ob-scheme to use
let-binding. Other ob-* lisp implementations may be OK (at least,
ob-emacs-lisp is OK).

Now, the main question is whether it is safe to use `define' in all the
scheme implementations. If it is, would you be interested in turning
your personal fix into a patch for ob-scheme?

Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]