DConf 2015?

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 24 01:22:16 PST 2014


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.


More information about the Digitalmars-d mailing list