Conversation
arturdryomov
commented
Jun 14, 2018
- Remove text duplicating code samples.
- Change headings structure.
- Just general fitting things together.
| @@ -1,124 +1,106 @@ | |||
| ## Koptional — Minimalistic Optional type for Kotlin | |||
| # Koptional — Minimalistic `Optional` type for Kotlin | |||
There was a problem hiding this comment.
That looks kinda ugly tbh
| > however in simple cases like passing `String?` through RxJava stream `Optional` is a more convenient solution. | ||
|
|
||
| >We also think that in many cases you can use `sealed class`es to express absent values, however in simple cases like passing `String?` through Rx stream `Optional` is a more convenient solution. | ||
| The goal of this implementation is to be convenient to use and fit Kotlin's `null`-safe type system, which resulted in: |
There was a problem hiding this comment.
Why render null-safe as null-safe? Here it's just a term rather than null pointer value
There was a problem hiding this comment.
Just to see a sweet, sweet formatting.
There was a problem hiding this comment.
but it's ugly :D
| compile 'com.gojuno.koptional:koptional-rxjava2-extensions:put-some-version' | ||
| implementation "com.gojuno.koptional:koptional-rxjava2-extensions:$koptional_version" | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Can you add Reactor pls?
There was a problem hiding this comment.
Sure. Nuked a separate README.md and inlined it here as well.
| val f = optional.toNullable() ?: "fallback" | ||
| ``` | ||
| #### Check if `Optional` is `Some` or `None` | ||
| #### Use [Smart Cast](http://kotlinlang.org/docs/reference/typecasts.html#smart-casts) |
There was a problem hiding this comment.
Let's not use word Use? It reads like we're forcing users to use these features :)
There was a problem hiding this comment.
The idea was to use verbs for the Usage section — create, convert, leverage and so on. I’m not opposed to change it though.
There was a problem hiding this comment.
Yeah I understand, I think it's fine in previous headers, but kinda odd here
"Interop with Java" doesn't have verb and looks fine :)
| Koptional supports [destructuring](https://kotlinlang.org/docs/reference/multi-declarations.html). | ||
|
|
||
| Destructuring has same effect as calling `toNullable()`. | ||
| #### Use [Destructuring](https://kotlinlang.org/docs/reference/multi-declarations.html) |
There was a problem hiding this comment.
Especially here, destructuring is not required in many cases but this doc sorta says USE IT
| Use the static `Optional.toOptional()` to wrap an instance of `T` into `Optional<T>`. | ||
|
|
||
| #### Filter only `None` values emitted by RxJava 2 or Project Reactor | ||
| ### Work with RxJava 2 |
There was a problem hiding this comment.
Maybe just "RxJava 2 Extensions"?
|
@artem-zinnatullin, addressed most of your comments. |