umka-lang icon indicating copy to clipboard operation
umka-lang copied to clipboard

Structured constants are not constants

Open vtereshkov opened this issue 1 year ago • 0 comments

type S = struct {
    x, y, z: int
}

const (
    a = [2]int{2, 7}
    b = []real{3.14, 6.28}
    c = S{7, 8, -3}
)

fn main() {
    a[1] = 6
    b[0] = -0.666
    append(b, 17.2)
    c.x *= 2
    
    printf("%v  %v  %v\n", a, b, c)   // [2 6]  [-0.666 6.28 17.2]  {x: 14 y: 8 z: -3}
}

vtereshkov avatar Jun 30 '24 09:06 vtereshkov