News for hackers. Stuff that matters.
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by ben_jones on Sunday September 04, 2016 @08:11PM (#12427361)
I've recently played with using nil pointer references as a form of default overloading. The process in the function block was something like:

1) assign default value to variable

2) check if pointer parameter is nil

3) if pointer is not nil assign pointer value to variable

4) do work with variable

Am I overlooking a simpler way to do this? I feel like lib.LibraryFuncion(nil, nil) is nicer then lib.LibraryFunction(lib.LibraryDefaultOne, lib.LibraryDefaultTwo), though admittedly the explicitness of the second option is appealing.

Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by brobinson on Sunday September 04, 2016 @09:53PM (#12427653)
Could you just create well-named functions which call LibraryFunction() internally rather than relying on the caller to specify 1 or more default arguments?
Re:Hello, I’m Mr. Null. My Name Makes Me Invisible to Computers by ben_jones on Sunday September 04, 2016 @10:06PM (#12427695)
Yeah. It's funny I'm currently working on two Go libraries one uses the convention you listed [1] and the other [2] uses nil pointers.

[1]: https://github.com/b3ntly/go-sms/blob/master/client.go

[2]: https://github.com/b3ntly/mLock/blob/master/lock.go

Disclaimer: Both libraries are in the pre-alpha stages and are extremely light on tests and/or broken.