You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It will run correctly once. If the cell is run again, it produces the following error:
cannot assign a value to variable workspace24.x from module workspace25
The current workaround is to set x to nothing before calling @variables x in the same cell. It seems that a new module is created every time a cell is run. We probably only care about the latest module, right? Would it be possible to "forget" about modules 1 through 24 in this example?
The text was updated successfully, but these errors were encountered:
You're right that forgetting about all unrecognized variables from previous workspace modules would fix the problem that you can't assign twice, but it will introduce a new problem: the variable only exists for one reactive run, and is forgotten afterward. This makes the macro even less useful 😥
Some packages (
MATLAB
,ModelingToolkit
) use macros for setting variables.MATAB
uses@mget x
to copy a Matlab workspace variablex
into a Julia variable calledx
.ModelingToolkit
uses@variables x y z
to initialize symbolic variablesx
,y
, andz
.In Pluto v0.11.12 (and all other versions I've used), you can't run any cell with either of these macros more than once.
Take
ModelingToolkit
's@variables
as an example. If a cell contains:It will run correctly once. If the cell is run again, it produces the following error:
The current workaround is to set
x
tonothing
before calling@variables x
in the same cell. It seems that a new module is created every time a cell is run. We probably only care about the latest module, right? Would it be possible to "forget" about modules 1 through 24 in this example?The text was updated successfully, but these errors were encountered: