“And Tamar put ashes on her head, and rent her garment of many colors that was on her.
”They learned in the name of Rabbi Yehoshua the son of Korcha:
Tamar made a great fence at that time.
They said: [If] to the daughters of kings this [happened], all the more so for the daughters of commoners!If to the modest ones this [happened], all the more so for the promiscuous ones!
Rabbi Yehuda said in the name of Rav:
At that time, they decreed about yichud and about the unmarried woman.
But yichud is biblical,
as Rabbi Yochanan said in the name of Rabbi Shimon the son of Yehotzadak:
‘Where is yichud hinted to in theTorah…?” ’ Rather say that they decreed upon yichud of an unmarried woman.
Rashi:
Tamar made a fence –with her tears and her cries, and she conducted herself in disgrace.The rest of the women made a kal vchomer with themselves. If [to] the daughters of kings…
[Babylonian Talmud Tractate Sanhedrin 21a]