The application relates to an immoalditol compound for selectively inhibiting glycosidases, a prodrug thereof and a pharmaceutical composition comprising the compound or the prodrug The application also relates to the use of the immoalditol compound for treating diseases and disorders related to deficiency or overexpression of O-GlcNAcase, accumulation or deficiency of O-GlcNAc Such diseases and disorders include neurodegenerative diseases, tauopathy, cancers, and cardiac disorders