[go-nuts] Re: Runtime code generation?

2017-05-19 Thread 'Eric Johnson' via golang-nuts
Indeed. This is the same answer I was going to give. Run-time code generation implies a whole bunch of different scenarios with a whole bunch of use-cases. There are resource sharing concerns, security concerns, and performance concerns that need to be nailed down. Otherwise it is difficult to

[go-nuts] Re: Runtime code generation?

2017-05-18 Thread Max
Hello, as others pointed out, a possibility is to use an interpreter. Maybe it's not what the original author wanted - execution speed may be a problem - but definitely possible. The interpreter https://github.com/cosmos72/gomacro is fairly complete (some features are still missing, for

[go-nuts] Re: Runtime code generation?

2017-05-11 Thread David Collier-Brown
I've doen generate-and-execute in C that way, at the cost of using LD_PRELOAD and having to restart the program. Go plugins should be better, as long as you don't have to drop one. Can you supercede one? It sort of looks like you could... If so, Go could do theequivalent of unload. --dave

[go-nuts] Re: Runtime code generation?

2017-05-10 Thread Erwin Driessens
You could let your application generate valid Go source, call the compiler to build a plugin, and load that plugin. I haven't tried that yet, but i think it should work. Downside is that you need to Go tools on the target machine for it to work. I don't know how many times you have to generate

Re: [go-nuts] Re: Runtime code generation?

2017-05-10 Thread YD Jiang
Thanks for the clarification. On Wed, May 10, 2017 at 10:34 PM Ian Lance Taylor wrote: > On Wed, May 10, 2017 at 12:19 AM, wrote: > > > > Why we can't generate executable memory segments? JIT runtimes just doing > > this I think. > > Generating executable

Re: [go-nuts] Re: Runtime code generation?

2017-05-10 Thread Ian Lance Taylor
On Wed, May 10, 2017 at 12:19 AM, wrote: > > Why we can't generate executable memory segments? JIT runtimes just doing > this I think. Generating executable memory segments in a language that supports converting integers to pointers opens up a wide attack surface in a buggy

[go-nuts] Re: Runtime code generation?

2017-05-10 Thread jan4984
Why we can't generate executable memory segments? JIT runtimes just doing this I think. On Sunday, September 1, 2013 at 9:23:11 AM UTC+8, Alan Donovan wrote: > > On Friday, 30 August 2013 16:21:18 UTC-4, jzs wrote: > >> Hi gophers, >> >> I was studying runtime code generation and was wondering