Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-27 Thread Paul Jolly
Of course you don't need to us go/ast for output (it's very likely used heavily when working out what to generate based on Go source input) - I generally create some simple helper types that wrap a bytes.Buffer, generate most code using text/template into said buffer, format using golang.org/x/tool

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-27 Thread Henry
Actually, it would be quite nice to simplify the Go's AST package and makes it simpler for people to develop custom code generation and tools. I use code generation quite a lot, eg. to generate data-access code, etc., but the process of creating one requires some effort to get right. I think go

Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-23 Thread Tong Sun
Quite agree. code generation will be especially helpful if it is not something trivial, and you need several rounds to make it perfect. @hui zhang, If you need something generic, take a look at https://github.com/go-easygen/easygen, For e.g., here is how I generate the command line CLI ha

Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-11 Thread Egon
On Saturday, 11 March 2017 02:27:49 UTC+2, Tyler Compton wrote: > > If we assume a more useful generic task than writing a min function, > what's wrong with using code generation? > There's nothing wrong with in it of itself. It's a tool like any other. Based on the limited information presented

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread prades . marq
You might want to reconsider your use of Go if the lack of generics hinders your productivity. Code generation, IDE macros and other tricks do not solve this problem. Sometimes go is just not the right tool for the job. D has generics and solid concurrency primitives. Le vendredi 10 mars 2017

Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Michael Jones
Nothing wrong with it, and nothing wrong with doing it for min and max either. (Though it was a delight to see that animated editing sequence, so for entertainment value that's the way!) I did code generation for my version of Sort and it is 3x-5x faster. It takes intel more than 10 years to make

Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Tyler Compton
If we assume a more useful generic task than writing a min function, what's wrong with using code generation? On Fri, Mar 10, 2017 at 6:14 AM Henry wrote: > If you insist on generics-like code generation: > https://github.com/cheekybits/genny/blob/master/README.md > > -- > You received this mess

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Henry
If you insist on generics-like code generation: https://github.com/cheekybits/genny/blob/master/README.md -- 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-

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Ignazio Di Napoli
Wow. :) -- 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.

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Egon
On Friday, 10 March 2017 10:29:20 UTC+2, hui zhang wrote: > > I want to generate a min func > Why? That doesn't sound like a good use of time. :P You would probably much faster using keyboard macros or multiple cursors e.g. (real-time)

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread hui zhang
And pls don't tell me interface{} is good , can solve your problem bla bla bla when interface{} meet slice []int --> []interface{} , all generic can not be done 在 2017年3月10日星期五 UTC+8下午4:29:20,hui zhang写道: > > > > I want to generate a min func > > func Min(a,b T) T { >if a < b { > re