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
Copy file name to clipboardExpand all lines: docs/src/internals.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -162,7 +162,7 @@ end
162
162
sizefloat(x::Float64) = 8
163
163
```
164
164
165
-
If you replace the loop with `for T in (Float32, Float64)`, then Revise should delete the method for `Float16`. But this implies that Revise can deduce all the method-signatures created by this block, which essentially requires "simulating" the block that defines the methods. (In simple cases there are other approaches, but for [complex cases](https://github.com/JuliaLang/julia/blob/c7e4b9929b3b6ee89d47ce1320ef2de14c4ecf85/base/atomics.jl#L415-L430) stepping through the code seems to be the only viable answer.)
165
+
If you replace the loop with `for T in (Float32, Float64)`, then Revise should delete the method for `Float16`. But this implies that Revise can deduce all the method-signatures created by this block, which essentially requires "simulating" the block that defines the methods. (In simple cases there are other approaches, but for complex cases stepping through the code seems to be the only viable answer.)
166
166
167
167
Because lowered code is far simpler than ordinary Julia code, it is much easier to interpret. Let's look briefly at a method definition:
Copy file name to clipboardExpand all lines: docs/src/limitations.md
+70-36Lines changed: 70 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,12 @@
1
1
# Limitations
2
2
3
-
There are some kinds of changes that Revise (or often, Julia itself) cannot automatically incorporate into a running Julia session:
3
+
## Struct revision
4
4
5
-
- changes to global bindings (but see below for struct definitions on Julia 1.12+)
6
-
- conflicts between variables and functions sharing the same name
7
-
- removal of `export`s
8
-
9
-
These kinds of changes require that you restart your Julia session.
10
-
11
-
## Struct revision (Julia 1.12+)
5
+
### Struct revision is supported on Julia 1.12+
12
6
13
7
Starting with Julia 1.12, Revise can handle changes to struct definitions. When you modify
14
8
a struct, Revise will automatically re-evaluate the struct definition and any methods or
15
-
types that depend on it.
16
-
17
-
For example, this now works:
9
+
types that depend on it. For example:
18
10
19
11
```julia
20
12
struct Inner
@@ -40,32 +32,10 @@ end
40
32
Revise will redefine `Inner`, and also re-evaluate `Outer` (which uses `Inner`
41
33
as a field type) and `print_value` (which references `Outer` in its signature).
42
34
43
-
## Binding revision is not yet supported
44
-
45
-
While struct revision is supported, more general "binding revision" is not yet implemented.
46
-
Specifically, Revise does not track implicit dependencies between top-level bindings.
35
+
On versions of Julia older than 1.12, Revise does not support changes to
36
+
`struct` definitions. These require you to restart your session.
47
37
48
-
For example:
49
-
50
-
```julia
51
-
MyVecType{T} = Vector{T} # changing this to AbstractVector{T} won't update A
52
-
struct MyVec{T}
53
-
v::MyVecType{T}
54
-
end
55
-
```
56
-
57
-
If you change `MyVecType{T}` from `Vector{T}` to `AbstractVector{T}`, the struct `A` will
58
-
**not** be automatically re-evaluated because Revise does not track the dependency edge
59
-
from `MyVecType` to `MyVec`. The same applies to `const` bindings and other global bindings
60
-
that are referenced in type definitions.
61
-
62
-
Supporting this would require tracking implicit binding edges across all top-level code,
63
-
which involves significant interpreter enhancements and is deferred to future work.
64
-
This limitation also underlies [the issues with macros and generated functions](@ref other-limitations/macros-and-generated-functions) described below.
65
-
66
-
As a workaround, you can manually call [`revise`](@ref) to force re-evaluation of all definitions in `MyModule`, which will pick up the new bindings.
67
-
68
-
## Workaround for the struct revision issue before Julia 1.12
38
+
### Workaround for the struct revision issue before Julia 1.12
69
39
70
40
On Julia versions prior to 1.12, struct definitions cannot be revised. During early stages of development,
71
41
it's quite common to want to change type definitions.
0 commit comments