sometimes you can write the simple one in terms of the advanced one. when
you can do that, it makes them better and also educational.

On Tue, Jun 6, 2017 at 7:09 PM, peterGo <go.peter...@gmail.com> wrote:

> M2,
>
> The Go strconv package (https://golang.org/pkg/strconv/) contains the
> simple forms Atoi and Itoa and the complex forms ParseInt and FormatInt. In
> the documentation for each function refer to the alternate form.
>
> Peter
>
> On Tuesday, June 6, 2017 at 3:56:43 PM UTC-4, M2 wrote:
>
>> I need to expose 2 ways of doing the same thing.
>>
>> - The first way is very simple, always does the right thing and is
>> impossible to use improperly. It is expected to be used by the majority of
>> users.
>> - The second one can be used improperly but offers more flexibility. It
>> is expected to be used by a minority of users.
>>
>> What is the idiomatic way in go to expose them?
>> 1). Have them both in the same package since they do the same thing and
>> just document them properly.
>> 2). Have them in different packages with one named .../unsafe/myPackage/
>> and one named .../safe/myPackage/ then have a third package that has all
>> the private stuff that will be accessed by both unsafe and safe package
>>
>> Thanks
>>
>> --
> 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.
>



-- 
Michael T. Jones
michael.jo...@gmail.com

-- 
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