According to the Mishna (98b) a person should not stand in a reshut ha-yahid (a private domain) and spit into a reshut ha-rabim (a public domain), or in a reshut ha-rabim and spit into a reshut ha-yahid, as you are transferring your saliva from one domain to another. Rabbi Yehuda teaches that even walking four cubits in the public domain with a collection of saliva in your mouth would be forbidden.
Rav Yosef on our daf comments that the rule in the Mishna about spitting would be considered a Biblical transgression, requiring the bringing of a sin-offering. The Ritva points out that this actually depends on the position that one takes with regard to a case that is a melakha she-ain tzrikha le-gufa – when a forbidden act is done on Shabbat with an intent other than that usually associated with that act. Since in the case of spitting, it is most likely that the intent was to get rid of the spittle and not specifically to have it reach the other reshut, those opinions that rule that one is not liable for such an act would disagree with Rav Yosef in this case.
This unusual discussion about spitting offers an opportunity for Resh Lakish to teach that a student who spits in front of his teacher is deserving of death.
Reish Lakish said: One who expelled phlegm in front of his master has acted in a disrespectful manner and is liable for the punishment of death at the hand of Heaven, as it is stated: “All they who hate Me love death” (Proverbs, or 8:36). Do not read it as: “They who hate [mesanai] Me”; rather, read it as: “Those who make themselves hateful [masniai] to Me,” i.e., those who make themselves hateful by such a discharge.
This rule is brought in a number of places by the Gemara with regard to Torah scholars whose conduct or manner of dress brings about an embarrassment to the honor of the Torah. In our case, Resh Lakish teaches that those students whose behavior angers their teachers and causes them to hate them are deserving of death, since “the awe of your teacher should be equivalent to the awe of Heaven.” Unlike the case in the Mishna, however, Resh Lakish certainly does not mean that such a person would be put to death for his crime, rather that such an act is so severe as to be deserving of death b’yedei Shamayim – by the Hand of God.