TA Orientation and Kotlin (Funny Number Issue)
Last Week
Was pretty busy.
TA Planning
I realized that the start of term wasn't too far off, and that meant I needed to help plan the TA orientation session for new and returning TAs. This is usually a pretty lightweight process, another faculty member usually chooses the dates and which sessions to run, and I just make sure that they're ready to go.
This time, the faculty member who I usually plan the training sessions with got sick 1, so that meant I was effectively in charge of planning the entire thing. This wasn't too big of a deal, except I'd wanted for a long time to redesign the slides used for these sessions. They didn't look so great. My estimate, based on the gratuitous amounts of clipart on them, is that they were first written in Microsoft PowerPoint 2003, and updated again and again. So now, I had to both plan the sessions, meaning contacting presenters, getting their availability, and booking a time, and redesign the slides.
It turned out to not be as annoying as I thought. I decided to go with UBC's branded typographic presentation template. Why UBC invested what is undoubtedly a metric crap-ton of money into making these templates, only to set Arial as the default font, I will never understand. In an ideal world, I would take a week or so to design these presentations from the ground-up from a blank Keynote file, but with two presentations that each had over 50 slides, I think I made an acceptable compromise.
Rest of the planning consisted of me scraping through my old emails to see who ran which sessions, and sending out a group email asking presenters if they wanted to present again. This went pretty well, and TA Training for 2021W2 is set for next week.
Kotlin
A large part of my week was also spent hacking on IntelliJ The time I spend hacking on IntelliJ usually consists of me making incremental changes to the source code, recompiling, and launching a local instance. This week was a bit different from others since I spent the majority of my time in the Kotlin part of the IntelliJ codebase. I'm not sure if it's because I'm coming from Scala, but there's a standout feature I miss about it: inline destructuring in pattern-matching expressions.
Say you had some data like this
case class Person(name: String, age: Int)
You can pretty easily match on this data like this:
val person = Person("John", 24)
val name = person match {
case Person(name, _) => name
}
This is a really contrived example (you can just do person.name
), but you get the idea. Kotlin has a similar feature, but instead of
match
they call it when
. The same example could be written like:
data class Person(val name: String, val age: Int)
val name =
when (person) {
is Person -> person.name
}
You're actually limited to matching on just the type of whatever you pass in, and can't really make any inline inferences on its structure as you match.
One thing that I think Kotlin does really well are extension methods. It's not like Scala where you have to throw around implicit
s everywhere (although this is made a little easier in Scala 3+). You simply define a method:
// Extension method for the Java.URI library
fun URI.isRickroll(): Boolean {
val addr = this.toString()
return addr == "https://www.youtube.com/watch?v=DLzxrzFCyOs"
}
-
I think something is going around. lol. ↩