Ray Rahke
02/23/2024, 9:00 PM++ to call it's tick() method, like clock++. However it looks like Kotlin says that the inc operator overload needs to return a new copy of the object, instead of mutate? Why? Is that how this behavior always works? I just want to mutate the clock's internal .now/.elapsed/.delta etc. Returning a new copy of the clock seems wasteful as I am going to call this function hundreds of times every few secondsephemient
02/23/2024, 9:03 PMx++ as
val tmp = x
x = x.inc()
tmp
and ++x as
x = x.inc()
x
the prefix and postfix forms aren't defined independently as they are in C++ephemient
02/23/2024, 9:04 PMx++ evaluates to the previous value of x, it isn't something that can easily be done by mutating in-placeephemient
02/23/2024, 9:04 PMfun inc() for in-place mutationRay Rahke
02/23/2024, 9:05 PMfun inc() you mean `clock.inc()`` ?Ray Rahke
02/23/2024, 9:05 PMephemient
02/23/2024, 9:05 PMephemient
02/23/2024, 9:05 PMRay Rahke
02/23/2024, 9:06 PMRay Rahke
02/23/2024, 9:06 PMRay Rahke
02/23/2024, 9:06 PMRay Rahke
02/23/2024, 9:06 PMRay Rahke
02/23/2024, 9:06 PMRay Rahke
02/23/2024, 9:06 PMRay Rahke
02/23/2024, 9:07 PMRay Rahke
02/23/2024, 9:07 PMephemient
02/23/2024, 9:07 PMRay Rahke
02/23/2024, 9:07 PMephemient
02/23/2024, 9:08 PMval x = mutableSetOf<Int>()
x += 1 // x.plusAssign(1)
var x = setOf<Int>()
x += 1 // x = x + 1 // x = x.plus(1)ephemient
02/23/2024, 9:09 PM