For a somewhat-related blast from the past, see Crockford's ADsafe:
Definitely would be interesting to perhaps include some concepts from ADSafe into LightningJS though - maybe in the bootstrap component?
Matt's loader is less focused on making javascript safe to embed from the security standpoint, and is more focused on ensuring that a 3rd part javascript file does not slow down your page.