This comes down to encapsulation I guess. You may want to hide some
internals and perhaps not other.
Simple data types are probably fine but say that you have an interface
Store then you can have redisStore or cassandraStore both implementing the
same interface and the rest of your program just operate on the interface
Store. Easy to change and (knock, knock) evolve.

tors 2 mars 2017 kl 07:50 skrev Henry <henry.adisuma...@gmail.com>:

> If you simply return unexported data types, there is no way your data
> users can understand what your data type does since godoc does not document
> unexported types.
>
>
> On Thursday, March 2, 2017 at 1:27:42 PM UTC+7, Tamás Gulácsi wrote:
>
> Accept interface (the smallest possible) but return concrete type -
> possibly a pointer.
> If you don't want people to mess with your data type directly, unexport
> (lowercase the first rune in the name) your data type.
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to