On Tue, May 06, 2025 at 10:51:28AM +0200, 'Ralf Hemmecke' via FriCAS - computer
algebra system wrote:
> Unfortunately, interpret_in_new_env does not keep interpreted macros
> private. :-(
>
> Ralf
>
> %%% (7) ->
> interpret_in_new_env(parse("xx==>5;yy:=xx+3")$InputForm)$InputForm
>
> (7) 8
> Type:
> PositiveInteger
> %%% (8) -> xx
>
> (8) 5
> Type:
> PositiveInteger
Well, interpret_in_new_env is doing what the name promises.
Unfortunately macro handling in interpreter is rather baroque,
interpreter distinguishes between "parser macros" which are
_not_ kept in environment and "interpreter macros" which
are mostly kept in environment. Few pre-build macros
are kept separately, but for some reason interpreter may
look in two environments, so there is some extra complication.
"parser macros" are kept in '$pfMacros', saving it we can
get behaviour that you expect for construct above. But
currently "parser macros" do not respect frames, so
they would still have different scope than other constructs.
I will look what can be done, probably we should turn all
macros into "interpreter macros".
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/fricas-devel/aBnszac6juUnSQGY%40fricas.org.