Namespacing, aesthetics, and interfaces
If, for whatever reason, you don't like the way method calls look, you can
use:
var a net.TCPAddr
_ = a.Family() // usual method call
_ = net.TCPAddr.Family(&a) // equivalent to above
If everything was a pure function, it'd look much like the se
On Thu, Jun 2, 2022 at 4:38 PM Deividas Petraitis
wrote:
> Background: when I am writing code mostly I end up with some clunky
> solutions I am not happy with and one of the reasons I think is that I
> might be mixing funcs vs methods.
>
>
Squint your eyes enough, and methods are just a special k
On Thu, Jun 2, 2022 at 4:38 PM Deividas Petraitis
wrote:
> 1. Structs are for representing things, they are things
Forget about structs. Methods are attached to types. Structs are just
one of the many kinds of types. Assuming structs only does not provide
the full picture one needs to think abou
On Thu, Jun 2, 2022 at 4:38 PM Deividas Petraitis
wrote:
> 1. Structs are for representing things, they are things
> 2. Funcs are for performing actions, calculating things
> 3. Methods for performing actions on thing state
> 4. Methods to satisfy interface
>
4 is really the *big* technical poin
Background: when I am writing code mostly I end up with some clunky
solutions I am not happy with and one of the reasons I think is that I
might be mixing funcs vs methods.
So the question is basically the title.
I have searched both in this group ( without a luck ) and in the Internet
for po