Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define isassigned(r::Ref) = isdefined(r, :x)? #18086

Closed
stevengj opened this issue Aug 17, 2016 · 2 comments
Closed

define isassigned(r::Ref) = isdefined(r, :x)? #18086

stevengj opened this issue Aug 17, 2016 · 2 comments

Comments

@stevengj
Copy link
Member

stevengj commented Aug 17, 2016

It really seems like we should be able to do isdefined(r::Ref), in analogy with isdefined(a) for a zero-dimensional array (in both cases, you access the contents with []). Right now, you have to do isdefined(r, :x), which is annoying because it depends on the internal implementation of RefValue.

Unfortunately, it's not as simple as Base.isdefined(r::Ref) = isdefined(r, :x) because isdefined is a builtin. Maybe Core.isdefined should be the builtin, and Base.isdefined should be a generic function that wraps around Core.isdefined?

(This came up in JuliaLang/IJulia.jl#447, cc @malmaud)

@malmaud
Copy link
Contributor

malmaud commented Aug 17, 2016

I agree this would be the best, but it might also be reasonable to use isassigned for this purpose, #18082.

@yuyichao yuyichao changed the title define isdefined(r::Ref) = isdefined(r, :x)? define isassigned(r::Ref) = isdefined(r, :x)? Oct 8, 2016
@yuyichao
Copy link
Contributor

yuyichao commented Feb 7, 2017

Closed by #18082

@yuyichao yuyichao closed this as completed Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants