• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Kotlin in Action: Language features of other programming languages that you wish Kotlin had?

 
Ranch Hand
Posts: 90
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am interested to know from the Kotlin in Action authors and knowledgeable Kotlin programmers whether there are language features of other programming languages that you wish Kotlin had.  If so, are there YouTrack issues to add these features?
 
author
Posts: 149
5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While there are improvements that I would like to see in Kotlin, I'm not really thinking about them in terns of "features of other programming languages". While there are some smaller welcome additions that can really be seen as simply a feature from another language, such as Java's multi-catch or Python's slice syntax, I'm much more looking forward to things that we can design ourselves (such as delegated properties, which don't really have a direct precedent in any other language)/
 
Daniel Trebbien
Ranch Hand
Posts: 90
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reading about delegated properties, this seems similar to Python decorators, although it's nicely tailored to properties because the property delegate implements both getter and setter delegation routines.

Does the standard Kotlin library provide memoization and LRU cache property delegates?

Is there a way to make a "static" property delegate, if that makes sense; by this I mean, is it possible to use a single instance of the property delegate for all instances of the class, rather than each instance of the class having its own instance of the property delegate?

Are there other features that are unique to Kotlin?
 
Dmitry Jemerov
author
Posts: 149
5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a standard delegate for memoization, but not for the LRU cache (this seems to be a fairly specific use case, I don't remember it coming up before).

Static property delegates are supported: you can put any expression after "by", and if this expression evaluates to a singleton object, then this object will be used as a delegate for all instances of the class. The specific instance is passed to the delegate as a parameter.

As for other unique features, I think our approach to inline functions is fairly unique.
 
I love a woman who dresses in stainless steel ... and carries tiny ads:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!