Nathan-Wall / proto

A programming language derived from JavaScript which emphasizes prototypes, integrity, and syntax.
Other
12 stars 1 forks source link

Non-transferable symbols #77

Closed Nathan-Wall closed 10 years ago

Nathan-Wall commented 10 years ago

76 will have symbols copied by the mixin operator. This will be the default behavior for all symbols. However, we should probably add a way for symbols to be made non-transferable. Non-transferable symbols would not be copied by the mixin operator.

Nathan-Wall commented 10 years ago

Non-transferable symbol properties can now be defined on an object using the following pattern:

sym @foo;
var obj1 = { };
reflect.define(obj, @foo, {
    value: 'bar',
    writable: true,
    configurable: true,
    transferable: false
});
var obj2 = { @foo: 2 } := obj1;
obj1.@foo; // 1
obj2.@foo; // 2