Idea how to fit collection literals into language


#1

Sorry if there was this one already :slight_smile:
Consider introducing operators createList, createMap etc
Provide Default implementation which will be imported
Since they are operators user can override them on per file(just don’t import default one) and per type basis

fun GlobalScopeOrSmthng.createList(vararg elements:Any?) = listof(*elements)
fun GlobalScopeOrSmthng.createList(objectToSpread:Any?, vararg elements:Any?) = *objectToSpread  +listof(*elements)

.

import GlobalSugar.createList

fun main(args: Array<String>) {
	val list = [1, 2, 3, 4, 5]
	val listConcat = [*list, 6, 7, 8, 9]
}