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 if there's a way 
>> to generate a function at runtime.
>>
>> Let's say we have a function: fun(a,b) {return a+b}
>>
>> This function is parsed to our program as a string, parsed and compiled 
>> to a function in go.
>>
>
> As others point out, you can't generate executable memory segments---but 
> you could always write an interpreter.   Go itself isn't ideally suited to 
> interpretation but there is no fundamental reason you couldn't implement 
> the complete language spec that way.  It would be quite a lot of 
> work---take a look at ssa/interp (in the go.tools repo) for a minimal (and 
> horribly inefficient) interpreter for a large subset of Go.
>
>

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