Open tecosaur opened 1 year ago
For modules, I think it makes more sense to use isdefined
.
I feel liked getfield
has always been a bit of a pun when used on modules.
But while we support it, it kins of seems like we should complete the metaphor with the others from
{has,get}{property,field}
Or deprecate it and provide an alternative
Or deprecate it and provide an alternative
That's basically what #44231 did and why we now have getglobal
. We don't really want to add a loud deprecation warning though since it's too commonly used and the benefits of the change aren't worth the annoyance of a ton of warnings
Makes sense. We really need to sort out deprecating warnings that warn only for deprecations that are directly your fault.
IMO we can close this as resolved
I don't think this is resolved since getglobal
only replaces getfield
. The docstring for getglobal
recommends getproperty
, so getproperty
definitely doesn't seem to be deprecated, but getproperty
is still in contradiction to hasproperty
for modules, so there is still an issue.
it is valid to add hasproperty(mod::Module, x::Symbol) = isdefined(mod, x)
? That could at least bring hasproperty
and getproperty
into alignment.
Or should getproperty
be deprecated for modules also? (e.g. at least remove it from the getglobal
docstring)
Seems valid, though I think it may be isresolved and ispublic?
Julia 1.8.2, Linux
I feel like the behavior of
{has,get}{property,field}
is a bit suspect when it comes to Modules. The following example should be sufficiently illustrative.