Dreams in On the Road are often religious in nature, featuring God (in odd forms) or Biblical imagery (such as a snake). We see hallucinations both as the result of drugs or physical extremity, but also in sober moments. Characters are concerned with the best way to understand their visions in order to use them and to learn from them.
Ed Dunkel’s "ghost on the sidewalk" becomes a symbol for each character’s alter ego. As Ed, Sal, and Dean evolve as characters, they each define what their own ghost on the sidewalk is, and subsequently break away from it.
Visions are the only way in which Sal emulates Dean’s madness. They are his glimpse into Dean’s other-world of spirituality and enlightenment.