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

Support for null in functions #9

Open
mnbjhu opened this issue Jan 17, 2023 · 0 comments
Open

Support for null in functions #9

mnbjhu opened this issue Jan 17, 2023 · 0 comments

Comments

@mnbjhu
Copy link
Owner

mnbjhu commented Jan 17, 2023

Currently functions only support the NotNull type.
Most functions in neo4j have the property f(null) = null and are null otherwise.
For this reason I think it makes sense to change most of the functions to have two signatures (probably implemented as an object with two 'invoke' functions)
These would be:
(A) -> B
(A?) -> B?
An example would be adding two longs, the function signatures would be:
operator fun LongReturn.plus(other: LongReturn): LongReturn // Current
operator fun Nullable<Long, LongReturn>.plus(other: LongReturn): Nullable<Long, LongReturn>
operator fun LongReturn.plus(other: Nullable<Long, LongReturn>): Nullable<Long, LongReturn>
operator fun Nullable<Long, LongReturn>.plus(other: Nullable<Long, LongReturn>): Nullable<Long, LongReturn>

I think this would both let the user take advantage of null safety when not using null types as well has not slowing people down by haivng to handle null types

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

1 participant