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

Add default null reference constructor #691

Merged
merged 1 commit into from
Oct 7, 2020
Merged

Conversation

jmert
Copy link
Contributor

@jmert jmert commented Oct 7, 2020

I think this is a better solution for providing a null reference that can be compared against — trying to fix deprecations in JLD and MAT showed that something like this would be useful.

I know this will have to be rebased after #690 is merged.

@musm
Copy link
Member

musm commented Oct 7, 2020

lgtm

@musm
Copy link
Member

musm commented Oct 7, 2020

This is going to conflict, do you want to me to merge this first or second?

@jmert
Copy link
Contributor Author

jmert commented Oct 7, 2020

I can do it second. I just put up another PR which is going to cause either one of us to need to rebase, so you might as well get the larger rename done first.

@@ -1262,7 +1263,7 @@ unpad(s, pad::Integer) = unpad(String(s), pad)

# Dereference
function getindex(parent::Union{File, Group, Dataset}, r::Reference)
r.r == HOBJ_REF_T_NULL && error("Reference is null")
r == Reference() && error("Reference is null")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it normal for a no arg constructor to have by default a NULL reference? I suppose it makes sense for this case, since by definition if there is nothing to reference it will be a null reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of it more in terms as providing a default zero-initialized data structure. It just so happens to be useful to compare against to indicate whether a reference is valid or not.

@musm
Copy link
Member

musm commented Oct 7, 2020

I don't see a reason against this.

@musm musm merged commit bf5778a into JuliaIO:master Oct 7, 2020
@jmert jmert deleted the null_ref branch October 7, 2020 03:24
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

Successfully merging this pull request may close these issues.

2 participants