Exactly, the difficulty is not really in producing valid code but meaningful code. Same with text generation - while a recurrent neural network might produce grammatically correct sentences, I don't think we're close to it producing an story with an actual plot, discernible characters etc.
What about a statically analyzable language? That could be factored into the loss function.
I was thinking the same. Not only that, if you would add multiple networks that, for example, weigh the possibility that a full line is "good" code, and another that evaluates a whole block (like google deep mind did with AlphaGo) so it looks like dense and complex code this could be a nice program trolling with pull requests on github :-D
> The real issue is that the code produced is meaningless.