Nameof to get names of program elements

Absolutely agree with @ilya.gorbunov. Ruby has long had the :thing syntax which is used wildley different than “thing”.

Semantism is a core pinnacle of strongly-typed languages which Kotlin strongly firmly in. To suggest a string literal solution and leave it up to “IDE refactoring” is literally against the whole belief system which Kotlin is built upon, let alone being a huge known Magic Strings anti-pattern. This is why we have enums and the strongly-typed ‘when’ (Kotlin) / ‘switch’ (Swift) statements, to get AWAY from string-based, non-typed workarounds.

I wouldn’t expect this answer from an intermediate developer, let alone the you guys.

2 Likes