News for hackers. Stuff that matters.
Re:Porting 4.5K lines of C to Go by surye on Friday August 04, 2017 @08:16PM (#14933444)
C# and Python (for examples) don't use getters and setters, they use properties which provide the same interface as direct access variables when the need arises for more complexity, client code doesn't need to know about it. Languages without this feature needs to make everything getter/setter if they don't want to break the API when something needs additional logic.
Re:Porting 4.5K lines of C to Go by TazeTSchnitzel on Saturday August 05, 2017 @08:55AM (#14935467)
And indeed Go code has its fair share of (otherwise) unnecessary getters because of this.
Re:Porting 4.5K lines of C to Go by fancy_pantser on Friday August 04, 2017 @08:52PM (#14933608)
Python does have properties, which work via decorators @property (which decorates a getter) and @foo.setter.
Re:Porting 4.5K lines of C to Go by typon on Friday August 04, 2017 @09:04PM (#14933648)
He literally just said that