Open KotlinIsland opened 2 years ago
Making collections immutable by default will be a pretty major change. Are you proposing a new language, forked from python?
Making collections immutable by default will be a pretty major change. Are you proposing a new language, forked from python?
Making collections immutable for static analysis purposes only, similar to making classes final by default, this will have no effect on any runtime behaviour, ie:
[0][0]=0
Would get a static error, but would run and complete without issue.
Using
Sequence
when you want an covariant or immutablelist
is not always optimal.We propose:
ListLike
/DictLike
etc protocolsmutable
use site modifier that will make mutation methods accessible (append, clear, etc)such that
A collection coming from third party code (inc std) would always be a
mutable[list]
.