Remus

bearophile bearophileHUGS at lycos.com
Wed Nov 7 19:21:02 PST 2012


Another interesting possible feature for Remus: as the usage of 
immutable structs becomes more common in D code, it becomes more 
useful a syntax to create an updated struct. Similar syntax is 
present in F# and other functional languages.

struct Foo { int first, second, third; }
immutable f1 = Foo(10, 20, 30);

Current syntax:
immutable f2a = Foo(f1.first, 200, f1.third);

A possible syntax:
immutable f2b = Foo(f1 with second = 200);

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list