Rav Yehuda quotes Rav as teaching that an individual who accepts upon himself to fast for personal reasons (as opposed to communal fast days determined by the beit din) can “borrow against the fast and pay back later” – i.e. he can choose to eat today and substitute another day of fasting instead.
Many of the commentators interpret this to apply only in a case where the person did not commit himself to fast on a specific day (e.g. where he planned to fast on a certain number of days during the year). Nevertheless, many of the rishonim (the Ra’avad, Rashba, Re’ah, Ritva and others) argue that the Gemara makes no such distinction and that a person can even switch his fast from one day to the next. These rishonim understand that this is Shmuel’s intent when he compares a personal fast day to a person who takes an oath. Someone who takes an oath to give charity, for example, can switch one coin for another, so long as they have the same value; similarly, fasting on one day is the equivalent of fasting on another.
There is one personal fast that must take place on a specific day – a ta’anit halom.A fast that is the result of a disturbing dream must be done immediately after the dream takes place. This rule is so severe that Rav Yosef teaches that someone who is disturbed by their dream must fast even on Shabbat, concluding that he will have to fast a second time as repentance for having “desecrated” the holiness of Shabbat by fasting.
Given Shmuel’s ruling that dreams are not to be seen as carrying with them any significance, the Ritva explains that the underlying idea of fasting because of a dream is that a very disturbing dream should be seen as a heavenly call to examine one’s actions. Thus, it is essential to act while the feeling of dread is still fresh. But how can one fast on Shabbat? Here the Ritva explains that eating on Shabbat is the fulfillment of the mitzvah of oneg Shabbat – making Shabbat pleasurable. Under such circumstances, a festive meal would not be enjoyable, and fasting is a more appropriate expression of oneg Shabbat.