umka-lang
umka-lang copied to clipboard
Null dynamic arrays could be considered valid
Like in go, null slices are considered valid, of length zero.
var s []int
fmt.Println(s, len(s), cap(s))
for i := range s { // no error
fmt.Println("%d", i)
}
When writing UI code, I often rely on zero initialization, and if I forget to initialize the empty slices, I get an error if I try to insert something or iterate it. It would be nice to have the slices initialize automatically out of convenience's sake. I'm open for discussing this