From 793eac3e1a55182a196b6aa0050508523b088980 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 23 Dec 2020 11:56:04 +0530 Subject: [PATCH] Slight wording tweaks [deploy] Signed-off-by: Harsh Shandilya --- .../posts/improvements-to-inline-classes-in-kotlin-1430.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/posts/improvements-to-inline-classes-in-kotlin-1430.md b/content/posts/improvements-to-inline-classes-in-kotlin-1430.md index 01b24d4..dc7fc34 100644 --- a/content/posts/improvements-to-inline-classes-in-kotlin-1430.md +++ b/content/posts/improvements-to-inline-classes-in-kotlin-1430.md @@ -25,7 +25,7 @@ This is _fine_, but there are hidden performance costs. Classes are initialized inline class EmailAddress(val value: String) ``` -This will result in the EmailAddress wrapper being erased at runtime into direct access of the underlying `value` field. The rules around this are not as simple as "`inline` means it will be inlined", and I recommend reading the [representation of inline classes] documentation to get a better idea. +This will result in the EmailAddress wrapper being erased at runtime into direct access of the underlying `value` field. The rules around this are not as simple as "`inline` means it will always be inlined", and I recommend reading the [representation of inline classes] documentation to get a better idea of what particular situations the compiler can optimize. ## Upcoming improvements for inline classes @@ -44,7 +44,7 @@ inline class EmailAddress(val value: String) { } ``` -On Kotlin 1.4.20, this will fail to compile with `Inline class cannot have an initializer block`. Being able to check values going into `inline` classes is valuable because ultimately most of us will be wrapping primitive types into these classes and will frequently have restrictions on what is valid. +On Kotlin 1.4.20, this will fail to compile with `Inline class cannot have an initializer block`. This change is valuable because ultimately most of us will be wrapping primitive types into these classes and will frequently have restrictions on what is valid, so being able to validate is extremely helpful to catch invalid values early. ### Primary constructor can be made non-public