|
|
|
|
|
by sabellito
1876 days ago
|
|
Ah thanks for pointing that out as I didn't make myself clear. I definitely didn't mean Java as a whole, as it is indeed a tremedously successful platform and language. I meant specifically the lack of flexibility in some regards because of the missing of monads and friends. For example, we have a few newer languages, TypeScript and Kotlin come to mind, implementing the "null operator": thing?.fieldA?.fieldB
While this is quite handy, and people unfamiliar with the Option monad will think that this new syntax is really cool, it poses two limitations:
1. It doesn't compose with other abstractions
2. I can't use this for my own abstractionsIf the language designers had chosen to take one step back and implemented it in a more generic way (in some sense, in the same as my other comment in this thread about implementing "map" without "reduce"), the feature could've still been implemented in the language, but without the limitations. I'm not sure what you meant with this point: > people lamenting the lack of monads in Java. Do you mean that, because you don't see people lamenting, it's not a useful feature? |
|
But monads don't compose with each other, do they? I thought you needed something more (monad transformers, algebraic effects, etc.) to get things to compose. Or maybe you meant something else by composition.
> I can't use this for my own abstractions
Yep. But Java doesn't even let you overload addition afaik, so being able to overload ? is pretty much a pipe dream.
> Do you mean that, because you don't see people lamenting, it's not a useful feature?
No, it's just that if something "backfired" for Java, I'd expect to hear people complaining about it.