News for hackers. Stuff that matters.
Re:Why most “clever” code ain’t so clever after all by mohaine on Tuesday July 12, 2016 @11:02PM (#12083653)
Adding properties would just make the language MORE complex. Then you would have fields, getters/setters AND properties. That said, a "property" keyword that auto-generated default getters/setters would be nice.

This was one of things that always bothered me about C#, What is the point of properties. What do the offer that public fields don't?

Re:Why most “clever” code ain’t so clever after all by tigershark on Wednesday July 13, 2016 @01:58AM (#12084134)
You don't need getters and setters in c#. If you don't have any side effect in a read-write property you can just use an automatic property. The same for read only properties that don't need to be recalculated on the fly. And I hope that I don't need to explain why using a write only property is almost always a code smell. In the other cases you can use a normal property with a backing field. If your code is well written and you use the appropriate tools, only rarely you need normal properties (that are as annoying as getters/setters).

What do getters and setters offer that public fields don't? Properties offer exactly the same advantage as getters and setters, fields encapsulation https://en.m.wikipedia.org/wiki/Field_encapsulation No wonder that you don't understand properties if you don't know why getters and setters are useful.

Re:Why most “clever” code ain’t so clever after all by krzat on Wednesday July 13, 2016 @03:34AM (#12084503)
I prefer Swift's solution, where fields and properties are unified. Makes so much more sense.