Safer variable reference compilation