yes they are reverse compatible straight off the shelf 4.0 into 3.9 (blocks that is) the cam shaft needs changing (and the crank length is different i'm sure on the 3.5 not sure about 3.9 !!) but the 3.9 is not compatible off the shelf in the 4.0 body
as ive said i did consider it and i looked into it thoroughly and the work required to bring a pre 94 block upto p38 requirements is not worth the hassle!!
you can get a block that you know is a good un or a complete engine for that matter without the risk of damaging a block/engine that can be sold to recoup some of the cash!!
i have a block that needs new rings, possibly pistons but they look fine, it'll only cost a couple of hundred quid to refurb, which is what i was going to do, you can have for 100 quid!!!