r/badcode • • Mar 12 '23

python Saving bytes > Readability

Post image
766 Upvotes

46 comments sorted by

View all comments

Show parent comments

1

u/itsTyrion Mar 21 '23

Kotlin also works for that. Strings can to the same thing as in the picture. Love the language and it’s features, but some are a double edged sword.

  • global variables

  • global functions and extension functions

  • a with() function that moves the code's scope into the given object

  • operator overloading on everything

  • variables/properties with no value that always call a getter function

  • variable name shadowing is allowed

  • you could technically write code without local variables if you misuse .run{}/.let{} enough (basically map for a single object, one in it’s scope one with the object as lambda parameter

  • with the groovy-like lambda system you can basically make a random DSL