[email protected]:~$

  • Better Error Handling In Kotlin With Either Type

    Note: This is not an authoritative article on how to handle errors in Kotlin/Java, but it is accurate. This is something that I wanted to try out for a long time. I would suggest you to look at Try from Arrow lib after reading this blog post. I use the...

  • Implementing C-Style For-Loops In Kotlin

    Kotlin does not have C-style for-loops. This is fine because I prefer using the idiomatic for-loops (built to use iterators) anyway. But there is a big problem: Kotlin does not allow dynamic limiting conditions in its for-loops (See this thread). This can sometimes get very annoying. To achieve the same...

  • Extending An Object's API With Delegation In Kotlin

    Task: Expose extra API methods for an object. Methods: Derive a new class from the class of that object, implement the extra functionality, make a new object from that new class. This method is suitable in cases where the new class has an “is-a” relationship with the actual class. In...