-
Notifications
You must be signed in to change notification settings - Fork 21
Refine readme file. #28
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks kinda ugly tbh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Narkomэn!
| > 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to see a sweet, sweet formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add Reactor pls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Nuked a separate README.md and inlined it here as well.
README.md
Outdated
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not use word Use? It reads like we're forcing users to use these features :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 :)
README.md
Outdated
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Especially here, destructuring is not required in many cases but this doc sorta says USE IT
README.md
Outdated
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just "RxJava 2 Extensions"?
|
@artem-zinnatullin, addressed most of your comments. |
artem-zinnatullin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍