Last week, I showed you my new implementation for instance-level properties in Python. This week, we’ll take another look at it by implementing a few Delegated Properties and helpers to make using them just a hair nicer.
Recreating Kotlin’s Built-In Delegates
For inspiration of what Delegated Properties to create, we’ll start by recreating the ones built into Kotlin, starting with
Lazy. Continue Reading
A while back, I did a post on making instance-level properties in Python where the implementation of it required inheritance as well as messing with
__setattr__(), which are a little dangerous to mess with. Then I had another idea last night (as of the time of writing this): Use normal descriptors to delegate to “Delegated Properties” (name taken from Kotlin, the original inspiration). These Delegated Properties can be designed very simply in a way that they only have to worry about the value on one instance, instead of figuring out how to store the value per instance. Continue Reading
Hello, readers! It’s been quite a while, and I don’t really have an excuse, again. The best excuse I have is that, since I still don’t have a job, my life isn’t very structured, and I don’t get a lot done without structure. I’m working on it, though. Continue Reading
Hey everyone! It’s my first post of the new year! Usually, I do a bunch of book reviews at the beginning of the year, and I will certainly do that in upcoming posts. UPDATE: No, I won’t. Not this year. Sorry.
Also, don’t worry that I may have given up on my video series; I haven’t. I’m simply being a moron and doing other, less important things in my free time. I’m sure I’ll whip myself into shape soon enough.
Lastly, I’ve received a bunch of free copies of my book from Apress, so I’ll be coming up with some way to give those away sometime soon.
Onto THIS article now.
I need to start this article with a disclaimer: this isn’t really even a good idea. It’s really just a thought experiment that I did, and I’d like to show you how it could be done if you ever wanted to do it. Continue Reading
Happy Thanksgiving all!
I finally created the first video of my video series on converting Java codebases to Kotlin. So I present it to you here as a Thanksgiving present.
Sorry if the audio is kind of clippy; I’ll be using more of a script for future videos to help keep me talking cleanly.
Kotlin doesn’t have true pattern matching, and that’s fine. In order to make matchable classes in Scala, there is an awful lot of overhead required to make it work, and I highly respect Kotlin’s goal of not adding much overhead anywhere. But that doesn’t mean we can’t try to make our own way to get something closer to pattern matching. Continue Reading