Yes, it is naive. All code has bugs. Some time ago some people though it would be good idea to encode contractual agreements with code. I guess it should be no sutprise that someone found a bug in the contract and got him/herself most of the money that was tied into the contract framework. If I recall correctly, we are talking about tens if not hundreds of millions of dollars of involuntary bug bounty in this particular case (google DAO hack of you have not heard)
Further, in my opinion there does not seem to be any solid logic what me and other humans think that is right or wrong, which makes it quite difficult to spell out preferred laws into code. (If someone disagrees, I am happy to hear one counterexample of moral axiom that holds always, without any exceptions whatsoever, realistic or unrealistic. Even for one single person)