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

Use java.lang.Optional on JVM #51

Open
drekbour opened this issue Nov 23, 2019 · 7 comments
Open

Use java.lang.Optional on JVM #51

drekbour opened this issue Nov 23, 2019 · 7 comments

Comments

@drekbour
Copy link
Contributor

Use expect / actual to allow Java 8 to provide the proper Optional implementation.

@adam-arold
Copy link
Member

We already have Maybe in Cobalt which we could use in Mixite to fix this, but I'm waiting for Arrow to become a MPP project (it is going to happen soon), then we could just use their implementation.

@drekbour
Copy link
Contributor Author

Yes. It was that Maybe that had me shivering and raising this :)

@adam-arold
Copy link
Member

So the Maybe is there because of MPP. We might be able to use Optional on the JVM but there is no such construct for Javascript / Native.

@drekbour
Copy link
Contributor Author

I see that Optional + Kotlin is a huge talking point in general. Should Mixite even bother? Or perhaps simply supply a JVM-only HexagonalGridDecorator which converts Hex? to Optional<Hex>.

Certainly all the "internal" uses of Maybe should be removed IMO!

@adam-arold
Copy link
Member

I'm not sure I follow. The problem in general is that we have to maintain API compatibility with Java, so that's why we have Maybe. It is going to be better when we can switch to Arrow's Option.

@drekbour
Copy link
Contributor Author

Looks impressive. Arrow appears to be a full-FP attempt (every language has one!) however modular they present it as. Do you feel that introducing the arrowverse is a little heavy for a small lib (like when hexameter enforced rxjava).

I'm not massively troubled but IMO Optional isn't adding much here (hence why KT doesn't have it). Personally I would deprecate those methods and move away rather than reinforcing the position by using a 3rd-party impl.

@adam-arold
Copy link
Member

What alternative do we have to Optional? I don't really want to use nullable variables.

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

2 participants