janvladimirmostert
06/16/2017, 10:56 AM{ }
a linkedHashMap, ConcurrentHashMap, etc
Suggestion, just like you can do operator overloading, maybe it’s worth providing something that allows literal overloading without actually providing a default implementation for it.
val listOfStrings = ["a", "b", "c"];
this will fail unless you extend String and give it squareBrackets implementation
literal fun String.squareBrackets(varargs String values) {
// package values in whatever type of List you want
}
Not sure if the extensions should happen on String or on MutableList for example if you want MutableList to be your implementation of the square brackets literals.
Same for { }
, allow literal extensions / overriding while the default implementation simply throws a NotImplementedException.