Compounds comprising a halogen and an alkaline earth metal, magnesium, beryllium, zinc, cadmium or mercury