Skip to content

Commit 2df5f57

Browse files
LiozouKristofferC
authored andcommitted
Remove obsolete paragraph on struct redefinition from FAQ (#59399)
The FAQ for Julia v1.12 and master still contains a paragraph that explains how to work around the impossibility to redefine a type in a REPL session. This paragraph is now obsolete thanks to #57253 so I propose to simply remove it. (cherry picked from commit 0c1fab4)
1 parent 2841be9 commit 2df5f57

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

doc/src/manual/faq.md

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -74,35 +74,6 @@ If memory usage is your concern, you can always replace objects with ones that c
7474
with `A = nothing`. The memory will be released the next time the garbage collector runs; you can force
7575
this to happen with [`GC.gc()`](@ref Base.GC.gc). Moreover, an attempt to use `A` will likely result in an error, because most methods are not defined on type `Nothing`.
7676

77-
### How can I modify the declaration of a type in my session?
78-
79-
Perhaps you've defined a type and then realize you need to add a new field. If you try this at
80-
the REPL, you get the error:
81-
82-
```
83-
ERROR: invalid redefinition of constant MyType
84-
```
85-
86-
Types in module `Main` cannot be redefined.
87-
88-
While this can be inconvenient when you are developing new code, there's an excellent workaround.
89-
Modules can be replaced by redefining them, and so if you wrap all your new code inside a module
90-
you can redefine types and constants. You can't import the type names into `Main` and then expect
91-
to be able to redefine them there, but you can use the module name to resolve the scope. In other
92-
words, while developing you might use a workflow something like this:
93-
94-
```julia
95-
include("mynewcode.jl") # this defines a module MyModule
96-
obj1 = MyModule.ObjConstructor(a, b)
97-
obj2 = MyModule.somefunction(obj1)
98-
# Got an error. Change something in "mynewcode.jl"
99-
include("mynewcode.jl") # reload the module
100-
obj1 = MyModule.ObjConstructor(a, b) # old objects are no longer valid, must reconstruct
101-
obj2 = MyModule.somefunction(obj1) # this time it worked!
102-
obj3 = MyModule.someotherfunction(obj2, c)
103-
...
104-
```
105-
10677
## [Scripting](@id man-scripting)
10778

10879
### How do I check if the current file is being run as the main script?

0 commit comments

Comments
 (0)