Re: [go-nuts] pointer value not updated when called as interface?

2016-11-20 Thread Sathish VJ
thank you. that works, and I think I also get the general idea. On Sunday, 20 November 2016 17:30:06 UTC+5:30, Jan Mercl wrote: > > On Sun, Nov 20, 2016 at 12:55 PM Sathish VJ > wrote: > > > In the code below, why is the value of s not changed in the calling > function? >

Re: [go-nuts] Re: Interface vs first-class function

2016-11-20 Thread 'Anmol Sethi' via golang-nuts
https://github.com/julienschmidt/httprouter https://github.com/pressly/chi and others actually use a function by default because it's the more common case. See https://github.com/pressly/chi/issues/94#issuecomment-254516724 On Mon, Nov 21, 2016 at 12:39 AM Tamás Gulácsi

Re: [go-nuts] Re: Interface vs first-class function

2016-11-20 Thread Tamás Gulácsi
I don't think so. A http.Handler usually has a ton of state, so a struct's method is handier than a closure. And take a look at http.HandlerFunc! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

Re: [go-nuts] Re: Interface vs first-class function

2016-11-20 Thread 'Anmol Sethi' via golang-nuts
In relation to this question, do you guys think it would have been better had http.Handler been a function, not an interface? On Sun, Nov 20, 2016 at 11:23 PM Henry wrote: > Thanks for the replies. In terms of future extensibility, is it safe to > say that interface

[go-nuts] Re: Interface vs first-class function

2016-11-20 Thread Henry
Thanks for the replies. In terms of future extensibility, is it safe to say that interface is superior to first-class functions? -- 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,

Re: [go-nuts] Re: Suggestion: port golang.org/x/mobile/exp/audio/al to Windows

2016-11-20 Thread Nigel Tao
On Mon, Nov 21, 2016 at 10:24 AM, wrote: > How to submit a change request? If you're asking about how to submit code that you have written yourself, the contribution guidelines are at https://golang.org/doc/contribute.html If you are asking how to file a feature request,

Re: [go-nuts] Re: Where to start to learn about Go compiler and others low level part?

2016-11-20 Thread Nguyễn Văn Cao Nguyên
Thanks you for the link! On Sun, Nov 20, 2016 at 7:15 PM Mandolyte wrote: > Here's a link to an article by someone else who went down this path and > they explain a bit about how they went about going deeper... > > http://thorstenball.com/blog/2016/11/16/putting-eval-in-go/

[go-nuts] Re: Interface vs first-class function

2016-11-20 Thread 'simon place' via golang-nuts
you'll need interfaces if you want your 'thing' to leave the programs context, to store/transmit it. -- 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

[go-nuts] Re: Suggestion: port golang.org/x/mobile/exp/audio/al to Windows

2016-11-20 Thread faiface2202
How to submit a change request? I'm posting to this group, because there is no issue tracker on the http://golang.org/x/mobile/exp/audio/al package. Dňa sobota, 29. októbra 2016 7:04:06 UTC+2 Daniel Theophanes napísal(-a): > > I would love to also see this happen. If you have time feel free to

[go-nuts] Dynamic linking against individual golang standard libraries

2016-11-20 Thread Parker Evans
Hi, Question about using dynamic libraries on Linux. So I know that creating a shared .so for the golang standard library can be done via the following (or some appropriate cross compiling variant): go install -buildmode=shared -linkshared std When stripped of debugging information, this

[go-nuts] Re: Race-free config hierarchy?

2016-11-20 Thread Dave Cheney
It looks like you've structured your config as a tree. If you decide to allow modifications to that tree, each modifying operation should return a new tree, leaving the original untouched. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Re: Race-free config hierarchy?

2016-11-20 Thread Tamás Gulácsi
> > Make your data structure immutable > Would you be so kind to elaborate it a little bit? If I use structs, then I still have to lock on config update. Or I could create a Cfg() which returns a copy, and SetCfg() for setting, and they'd do the locking with RWMutex? -- You received this

[go-nuts] Re: Why is src modified when concatenating slices with dst = append(dst, src[:i])

2016-11-20 Thread Bogdan Katyński
Thank you very much for the replies. I've read the blog about slices again and I'm pretty sure I know what is happening in my example and how are dst and src interconnected. I've started thinking how I can achieve what I'm looking for in the nicest way, and after some trial and error, I've come

[go-nuts] Re: Using go to write plugins for a C host application

2016-11-20 Thread ebw
The following answer to a similar question answers how to do, what I want to do without altering commands issued by go build -x. Maybe I should had rephrased my question. https://groups.google.com/d/msg/golang-nuts/NPEKogRR9Q0/IC-IUUy7CQAJ So you can declare symbols as weak (which I didn't

[go-nuts] Re: Interface vs first-class function

2016-11-20 Thread Chris Hines
I tried to break down the thought process on this exact question earlier this year and gave a presentation at my local Go meetup. My slides are here: http://go-talks.appspot.com/github.com/ChrisHines/talks/non-orthogonal-choices-in-go/non-orthogonal-choices-in-go.slide

Re: [go-nuts] Using go to write plugins for a C host application

2016-11-20 Thread ebw
Hi! Thanks for your answer! Am Sonntag, 13. November 2016 21:42:20 UTC+1 schrieb Justin Israel: > > > > I had been down a similar path where I was trying to port a go library to > C++ via building a c-shared library and then delegating to it from a thin > C++ API. > Turned out I hit problems

[go-nuts] Re: Interface vs first-class function

2016-11-20 Thread atd...@gmail.com
To be more concrete, taking your example, PerformWork cannot be easily customized according to the type of first class function that returns a func(Data). Actually it goes further, because that first class function can "only" return a func(Data) and not multiple functions. With an interface,

[go-nuts] Re: Interface vs first-class function

2016-11-20 Thread atd...@gmail.com
You have less indirection with the interface. More ergonomic. An interface also allows to define a set of constraints whereas the first class function does not coerce you into having a defined set of function arguments. On Sunday, November 20, 2016 at 6:22:57 AM UTC+1, Henry wrote: > > Hi, > >

[go-nuts] Re: Where to start to learn about Go compiler and others low level part?

2016-11-20 Thread Mandolyte
Here's a link to an article by someone else who went down this path and they explain a bit about how they went about going deeper... http://thorstenball.com/blog/2016/11/16/putting-eval-in-go/ On Friday, November 18, 2016 at 10:41:57 PM UTC-5, nvcnvn wrote: > > All I ever do is some simple web

Re: [go-nuts] pointer value not updated when called as interface?

2016-11-20 Thread Jan Mercl
On Sun, Nov 20, 2016 at 12:55 PM Sathish VJ wrote: > In the code below, why is the value of s not changed in the calling function? Interface is just a value, to indirect through a pointer it contains one can do something like: https://play.golang.org/p/qbx6ltL_SN -- -j

[go-nuts] pointer value not updated when called as interface?

2016-11-20 Thread Sathish VJ
In the code below, why is the value of s not changed in the calling function? func f(resp interface{}) { resp = "abcd" } func main() { var s string f() fmt.Println(s) //prints blank? } Play link: https://play.golang.org/p/KtfooO-cNt -- You received this message because you are subscribed

[go-nuts] Why is src modified when concatenating slices with dst = append(dst, src[:i])

2016-11-20 Thread Val
Hello Bogdan You're asking a very legit question. Slices are powerful but using combinations of append and reslicing can be surprisingly subtle. Step1 is easy: slicing is basically creating a new header referencing a position in an existing array, it does NOT by itself modify src. Step3 is