Method prefixes in Go -
in go, there's "prefix" can put on function. how useful? use cases this?
example:
type struct { thing string } func (something a) b() { fmt.println(something.thing) }
programming communication: communicating machine should do, , communicating other programmers (including future self). many higher-level programming constructs serve purpose of making code more expressive--that is, more stating programmer's intent.
go's function receivers "self" object in more traditional object-oriented languages. it's way of grouping set of functions , saying "these methods exist operate on objects of type", rather being general utility methods happen take argument of type. in other words, exist describe behavior of abstract object state described structure.
Comments
Post a Comment