We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

iamraajkanchan • 1 year ago

Couldn't find the operator function equals, in the Equality and Inequality section.

Seti • 3 years ago

Looks like there is typo in:

// Here how to provide `+` operator on our object Point
operator fun plus(p: Point) = Point(this.x + p.x, this.y + p.x)
// return type is inferred to Point

Pär Amsen • 6 years ago

I've used Kotlin for ~6 months daily, but damn it's hard to know establish new best practices with all these concepts introduced! Earlier today I introduced operator + overload in an Rx auto dispose thingy I'm doing, but it felt awkward and weird to write `autodispose + rxThing.first().subscribe(...)` -ish code.

Do you know if there has been any work done to establish best practices, like the Java clean code guide, but for Kotlin and other "next gen" languages?

romainbsl • 6 years ago

It seems to be awkward indeed. I heard that JetBrains is working on a guide about coding conventions. But nothing official yet.
You could post your snippet on the Slack (kotlinlang.slack.com) channel (#codingconventions). and we should be able to help you with it.

[CG]Nick • 6 years ago

I do not know Kotlin yet, but features like this make it look sexy

romainbsl • 6 years ago

And it's just ONE feature into the huge panel of Kotlin's features. ;-)
It's made sexy by a lot of little things, among big ones too :-)