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 isNotNull for IonElement Interface #78

Open
lziq opened this issue Jul 25, 2022 · 4 comments
Open

Add isNotNull for IonElement Interface #78

lziq opened this issue Jul 25, 2022 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@lziq
Copy link

lziq commented Jul 25, 2022

For IonElement interface, currently we have isNull method to check if the value is null. Can we also add the method isNotNull to provide better ergonomics for users to write code?

@lziq lziq changed the title Add isNotNull for IonElement Add isNotNull for IonElement Interface Jul 25, 2022
@popematt
Copy link
Contributor

popematt commented Aug 1, 2022

For anyone who wants this, as a workaround for now, you can create your own extension function like this:

fun IonElement.isNotNull(): Boolean = !isNull()

@popematt popematt added enhancement New feature or request good first issue Good for newcomers labels Aug 1, 2022
@AndrewChildre
Copy link

Did you just want this defined in the interface? I would do something like

public val isNotNull: Boolean

I'm a rookie < 1 year at my job just looking to contribute to some open source projects for some more experience. The pace of dev is slow where I work and I want to build my skills faster. Just rying to help. Thanks

@popematt
Copy link
Contributor

popematt commented Aug 9, 2022

Hi, thanks for your interest!

Did you just want this defined in the interface?

Something that is unstated but implied is that classes which implement IonElement would also need an implementation of isNotNull. (Otherwise the library won't compile.)

We would like for this change to be backwards compatible, so the implementation should be a default implementation in IonElement since consumers of the library can create their own implementations of IonElement.

Feel free to follow up with any more questions you may have—I'm more than happy to help.

@AndrewChildre
Copy link

Thanks for getting back to me. I'm going to dig into this to see if I can understand it some more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants