lmiq
December 17, 2020, 4:05pm
1
As simple as that. Any file calling subtypes
fails to be run as a script, or loaded with julia -i
:
% julia -e "subtypes(Real)"
ERROR: UndefVarError: subtypes not defined
Stacktrace:
[1] top-level scope at none:1
leandro@pitico:~/Drive/Work/JuliaPlay% ~/programs/julia/julia-
julia-1.4.2/ julia-1.5.1/ julia-1.5.2/ julia-1.5.3/ julia-d562a97f2b/ julia-vim/
leandro@pitico:~/Drive/Work/JuliaPlay% ~/programs/julia/julia-d562a97f2b/bin/julia -e "subtypes(Real)"
ERROR: UndefVarError: subtypes not defined
Stacktrace:
[1] top-level scope
@ none:1
julia> parentmodule(subtypes)
InteractiveUtils
which is only loaded in interactive sessions by default (see the manual).
5 Likes
subtypes
is in the InteractiveUtils
standard library, you need to load it first. This is done automatically only in the REPL
4 Likes
lmiq
December 17, 2020, 4:23pm
4
Tamas_Papp:
(see the manual).
I know you are huge fan of the manual but:
If one clicks on subtypes
there, one arrives here:
We might guess that with that name that package is not loaded for scripts, but if we click in the entry at the menu, we arrive here: Interactive Utilities · The Julia Language (and nothing again).
So it might be written somewhere, but I can assure you that you are much faster than my docs search . Thanks again.
1 Like
jling
December 17, 2020, 4:30pm
5
the error is clear, it’s not defined, so naturally one finds out where it is defined.
it is also written somewhere REPL loads interactiveutils
1 Like
lmiq
December 17, 2020, 4:44pm
6
Oh yes, sure it is written somewhere. But searching for “REPL” (which I really would never think of facing this problem), leads to: Julia v1.8 Release Notes · The Julia Language
or to this (second entry): Environment Variables · The Julia Language
or to this (third entry): Frequently Asked Questions · The Julia Language
Even if I had “naturally found” where it is defined, I could not deduce if that was expected, or not.
I am not sure where it is written — maybe I just recalled this from somewhere. In any case, perfect opportunity to improve the docs, hence
JuliaLang:master
← tpapp:tp/mention-interactive-mode
opened 01:56PM - 18 Dec 20 UTC
I am not sure if it is documented elsewhere. Cf [discussion](https://discourse.j… ulialang.org/t/julia-e-subtypes-real-fails/51991/).
Closes #36578.
3 Likes