▲ | hmry a day ago | |
> This contrasts to Go's approach, much like python, of using casing convention to determine private vs public fields. ( Please correct me if I'm wrong on this? ) I think calling it a convention is misleading. In Python, you can access an _field just by writing obj._field. It's not enforced, only a note to the user that they shouldn't do that. But in Go, obj.field is a compiler error. Fields that start with a lowercase letter really are private, and this is enforced. So I think it's better to think of it as true private fields, just with a... unique syntax. |