On 2/10/16 11:51 PM, Matt Elkins wrote:
* The in keyword. This is nice syntactic sugar over having a special trait in C++ which deduces whether to pass by value or const-reference. "foo(in bar)" is way more readable than something like "foo(traits<bar>::fast_param bar)"
Hm... in is short for scope const. It is not pass by reference. Perhaps you meant auto ref?
* @property. This little feature has been invaluable in porting my C++ code, letting me shave off tons of accessors and mutators that existed only for the sake of possibly being needed in the future. I didn't even need to use @property for this; its simple existence did the work for me!
Well, interestingly, D still allows property syntax without the @property notation. I'm in the habit now of never documenting accessors with @property. Mutators, I still would like to see D require @property to access that syntax.
Note that the only good reason to defensively add accessors and mutators for public fields is to keep a consistent binary API. In other words, if have a shared library. D is not quite there yet for shared library support, however.
-Steve