(building DNAs in c/c++ is dangerous, you can't sandboxing this. at least with a granularity nessesary.
interpreted, prototype and self reflectional languages are much better for this, they are also widely used
within academic ai research and there are several good reason for this.)
I'm looking at javascript, lua, and scala. Instead of embedding code in the blockchain, it might be interesting to store a reference to code and some kind of SHA.
edit: have seen you are thinking about referencing to outside code, e.g. hosted on a webserver. yes, this is another solution but not decentralized and therefore
not optimal and we couldn't say to the press nxt has launched the first and only real DNA in cryptocountry, living completly within the blockchain and doing a usefull
job for the users. sure, it is difficult pressing advanced stuff, optimal with choosable gui capabilities, into the tiny 1kb AM limit but it would be great if we could.
The code wouldn't be any less decentralized than NRS itself. Something has to read the code from the blockchain and execute. That code would provide a
context for the blockchain embedded code. It could be distributed p2p just like NRS could be.
The problem as you mentioned is the serialization of functions/closures. There's a interesting idea presented for inclusion in Scala called
Spores to handle serialization of closures. The very cool thing about Scala is that it runs in the JVM so it can drop right into the existing NRS as
NRS plugin (servlet in nxt/webapps).
Javascript would be interesting with something like
Rhino embedded in a
NRS plugin.
Msgpack would squeeze a bit more out of the 1K for AM. It would be possible to write a
DSL that would stuff even more functionality into an AM.
I'm not sure why folks are so hung up on c/c++. The choice of Java (and indirectly the JVM) opens some very interesting possibilities. I've been thinking a lot about what an implementation NXT in Scala with
Akka would look like and steal some ideas from
Spark. The amazing part is to just extract the algorithmic stuff (BCNext secret sauce) into a standalone Java class then import that into a new environment to handle the networking/protocol piece and provide a framework for extending NXT directly by writing plugins that run on the JVM.
If we could formalize NXT as a platform by providing a framework for developers to extend the NXT blockchain in a standard, predictable manner then things will be very interesting very quickly.