On Tuesday, 23 December 2014 at 17:19:23 UTC, Adam D. Ruppe wrote:
var d = json!q{ "foo": { "bar": 10.2 } };

writeln(d.foo); // {"bar":10.2}

d.foo.bar = (var a) => a ~ b;

writeln(d.foo.bar()("hello! ")); // double parens cuz @property isn't right
// hello! 20

According to javascript convention, if you stored a delegate in object's property, d.foo.bar("hello! ") is still a method `bar` called on a value from property `foo`, it's forwarded internally to the delegate when `bar` happens to be a property.

Reply via email to