Language doesn't prevent you from introducing such a check, but self-assignment falls into category of programmer mistakes. I.e. you will have to pay for the checking in every operation, while this should not be done in the first place.