fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
4.97k stars 288 forks source link

Confusing error and history-dependence with circular reference through `using` #2090

Open yha opened 2 years ago

yha commented 2 years ago

Example notebook:

OrderedDict(1:5 .=> rand.(3))
begin
    using DataStructures
    k = sort!(collect(keys(d)))
end
  1. Assigning the OrderedDict of the first cell to d it complains that OrderedDict is not defined, although it previously worked in the same cell. It should flag a cyclic reference instead.
  2. Removing the assignment to d, the error on the first cell persists, although it wasn't there before in an identical notebook state.
  3. Rerunning the last cell manually clears the error in the first cell (although the second cell still errors)

pluto-using

fonsp commented 2 years ago

@Pangoraw the suggested fix is to treat a cycle as an error, even when some of the cyclic links are soft. What are the edge cases here? Would it be easy to implement?

fonsp commented 2 years ago

I also can't explain the history dependence, how about you? @Pangoraw

fonsp commented 1 year ago

This is probably caused by https://github.com/fonsp/Pluto.jl/pull/1668 (which was definitely a good change!)

This case in this issue should be a cyclic error, but it needs some puzzling to figure out how this issue differs from the ones fixed in #1668, and how to handle it. 🤔