mfichman / jogo

High(er) performance compiled programming language with clean, powerful syntax
MIT License
6 stars 1 forks source link

Copy-on-write semantics for value params #48

Open mfichman opened 12 years ago

mfichman commented 12 years ago

Value parameters that are modified should automatically be copied once upon entry to the function. This may interact w/ the copier, but custom copiers are not yet allowed.

sample(vec Vec3) {
    vec.x = 10
    vec.mutate()
}

Possibility: Allow immutable types to be declared:

Vec3 < immutable Value {
    x Float
    y Float
    z Float
}