BTW, I understand generics is not top priority and will show up in Go
sometime later. But I happened to notice data structure code with generics.
I liked the idea of writing code once for all data types. For example:

https://github.com/raywenderlich/swift-algorithm-club
https://github.com/raywenderlich/swift-algorithm-club/blob/master/Stack/Stack.swift

Hope someday we will have one like this for Go.

Regards
dharani

On Wed, Dec 12, 2018 at 12:37 AM Tharaneedharan Vilwanathan <
vdhar...@gmail.com> wrote:

> This is great! Thanks for the details, michal!
>
> Regards
> dharani
>
> On Wed, Dec 12, 2018 at 12:27 AM <mic...@scylladb.com> wrote:
>
>> Google has it's own tool that is publicly available as part of gvisor
>> project [1] I think it's as good or better than the provided options.
>> I copied that to enable installation using plain go get (without bazel)
>> [2].
>> We used that to de-interface github.com/fatih/set so you may see a real
>> usage example [3].
>>
>> [1] https://github.com/google/gvisor/tree/master/tools/go_generics
>> [2] https://github.com/mmatczuk/go_generics
>> [3] https://github.com/scylladb/go-set
>>
>> $ go get github.com/mmatczuk/go_generics/cmd/...
>> $ go_generics -h
>> Usage: go_generics [options]
>>   -ast
>>         prints the AST
>>   -c A=B
>>         reassign constant A to value B when A=B is passed in. Multiple
>> such mappings are allowed.
>>   -i file
>>         input file
>>   -import name=path
>>         specifies the import libraries to use when types are not local.
>> name=path specifies that 'name', used in types as name.type, refers to the
>> package living in 'path'.
>>   -o file
>>         output file
>>   -p name
>>         output package name (default "main")
>>   -prefix prefix
>>         prefix to add to each global symbol
>>   -suffix suffix
>>         suffix to add to each global symbol
>>   -t A=B
>>         rename type A to B when A=B is passed in. Multiple such mappings
>> are allowed.
>>
>> On Tuesday, December 11, 2018 at 11:25:57 PM UTC+1, Tharaneedharan
>> Vilwanathan wrote:
>>>
>>> Thank you for the details!
>>>
>>> Regards
>>> dharani
>>>
>>>
>>> On Tue, Dec 11, 2018 at 2:13 AM <ffm...@web.de> wrote:
>>>
>>>> Here are some code generators that let you define template parameters:
>>>>
>>>> https://github.com/cheekybits/genny
>>>> https://github.com/taylorchu/generic
>>>> https://github.com/joeshaw/gengen
>>>> https://github.com/clipperhouse/gen
>>>>
>>>> Making use of Go templates:
>>>>
>>>> https://github.com/ncw/gotemplate
>>>> https://github.com/droundy/gotgo
>>>>
>>>> Am Dienstag, 11. Dezember 2018 04:00:57 UTC+1 schrieb Tharaneedharan
>>>> Vilwanathan:
>>>>>
>>>>> Hi All,
>>>>>
>>>>> I have a quick question.
>>>>>
>>>>> What is the best choice for writing generic code till Go officially
>>>>> supports generics? Just looking for some guidance.
>>>>>
>>>>> Regards
>>>>> dharani
>>>>>
>>>>> --
>>>> 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/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.
>>
>

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