https://kotlinlang.org logo
#san-diego
Title
# san-diego
m

mjthornton

03/25/2020, 4:18 AM
@ianbrandt soooo are we going to live stream the Kotlin meetup next month?
i

ianbrandt

03/26/2020, 3:31 AM
Hi Mitch, I think we could use Google Meet and it should work okay. The main thing we still need is a speaker, or a few lightning talks. I've asked a couple people, but no luck so far. I've got a few things I've been toying around with, but nothing that would likely be ready in time for next week.
Actually, I've got one thing I could demo about using JUnit 5's
DynamicTest
from Kotlin for parameterized unit testing. It's really only enough content for a quick lightning talk, though, so we'd need something more or it'll be a pretty short meeting.
m

mjthornton

03/26/2020, 4:09 PM
I wouldn’t mind doing some research on Kotlin Higher Order Functions… i.e. Run, Let, Apply, etc….. It’d probably end up being 15 - 30 mins to go in depth
@August Gruneisen Do you have anything you’d present on?
Some other things I need to learn more about is • When to use lateinit vs lazy in Android Dev • Reified • Inline • Generics • Alias …. I have an idea but wonder if there’s more to it • Writing Gradle Tasks… Could be a Groovy --> Kotlin equiv • Coroutines
a

August Gruneisen

03/26/2020, 4:16 PM
I could do something on lateinit vs lazy regarding thread safety. Maybe 15-30 minutes as well :)
l

Lou Morda

05/05/2020, 4:44 PM
I'd love to hear more about lateinit vs lazy, my coworker says lateinit is evil! I like that lazy works well with LiveDatas
i

ianbrandt

05/05/2020, 5:23 PM
I was experimenting with lateinit for my
previousWallTimeNanos
property here:
Copy code
private const val UNINITIALIZED = -1L

class GameClock {

	private var previousWallTimeNanos = UNINITIALIZED

	var deltaTimeNanos: Long = 0L
		private set

	fun update(wallTimeNanos: Long) {

		if (previousWallTimeNanos == UNINITIALIZED) {
			previousWallTimeNanos = wallTimeNanos
			return
		}

		deltaTimeNanos = wallTimeNanos - previousWallTimeNanos
		previousWallTimeNanos = wallTimeNanos
	}
}
Unfortunately...
Copy code
'lateinit' modifier is not allowed on properties of primitive types
So I ended up going with the plain old "if uninitialized" logic. The use case is single threaded, so I didn't need to worry about synchronization. I thought about creating a "LateInit" property delegate, but I'd only need it for the one instance in this application, so it didn't seem worth the added complexity. I'm a little surprised there isn't already such a property delegate in the #stdlib. Maybe I'll write one up and submit a pull request.