On Tue, Nov 26, 2013 at 1:22 PM, Hǎiliàng <
hwan...@gmail.com> wrote:
> When a constructor (function) returns a pointer of a struct (or other
> nullable type like an interface), it is usually named like NewXXX, and there
> is also a builtin function new that returns a pointer, so their names are
> consistent. The word "new" usually implies that an allocation happens and it
> needs a pointer (or interface) to point to the allocated space, and the
> pointer (interface) itself could be nil.
If you free yourself from the notion that New implies allocation, and
embrace the idea that New returns a new thing for you to use, that
would solve the problem, right ?
>
> But what if the constructor does not return a pointer but a struct itself?
> Should I also name it as NewXXX? or MakeXXX? or anything else?
>
> Hǎiliàng
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
golang-nuts...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.