Open xGnoSiSx opened 3 years ago
Thanks for your question. We have not currently planned any such activities. Can you elaborate a bit more as to which part of the library you would like to be made available in a more convenient way, e.g. with some pseudo code examples?
Hi,
Very simple: Operator overloading. Kotlin allows you to define functions with special names to make it possible to define natural mathematical operatos on custom types: Kotlin reference
This includes, comparison, unary, binary, and augmented assignment operators.
I just picked up this library and will probably be writting those as inline extension helpers for Decimal3f, without changing the library. Extensions
I can send/upload those, for that datatype and you can just copy/paste and replace for the other types.
Example:
inline fun Decimal3f.plus(b : Decimal3f) : Decimal3f {
return this.add(b)
}
And after that, you can write:
var result: Decimal3f = a + b + c + d
You could also add helper extensions for Longs, but these could get tricky.
There's also increment operators, but may be difficult to decide the increment step. I'd assume by 1 but others might think that's wrong. You could leave that up for users to define.
Any chance you will be adding some kotlin convenience code?