A spectacle viewed from the side is designed to be supported by two points. The ear and the nose bridge.
A spectacle is a cleverly designed optical device that has evolved over the centuries to its current form. The general layout of current spectacle frame design has been around for so long that the mechanics of its retention mechanism has been taken for granted. The main requirement is about keeping the lens in place, in front of your eyes without having the need to hold onto it by hand. From a mechanical perspective, the modern spectacles are held on the face by two point contacts which is at your nose bridge and by your ear. When looking straight ahead, the spectacle is in perfect equilibrium with its centre of gravity between the two contact points and will not slide.
The spectacle temple/arm is needed to prevent the spectacle from sliding off.
While all is fine if you only look straight or up, things become uncomfortable when you need to look downwards. On perfectly smooth or lubricated (with perspiration) surface, the spectacle would start to slide down under its own weight. This is where the spectacle temple have the additional function of holding onto your head. The most common temple designs are the skull temple design and the straight-arm/library design.
The skull temple is the most commonly used design and it is probably the most comfortable for prescription lens. The temple arm has a bend that contours round the back of your ear that keeps the spectacle from falling off without applying a high pressure. Much of the temple is also in contact with your skin which will have a larger friction compared to pressing against your hair. Greater friction can be generated without needing a large force pressing against your head to keep the spectacle in place.
The library temple is designed for easy put on and removal. It is commonly found in sports eyewear but less so in prescription lens. The straight arm makes it easier to remove from the head but a larger force is needed from the temple to keep it in place. Non-prescribed lens are typically lighter and the library temple does not need to press tightly against the head for sufficient anchorage. Such design is usually meant for short wearing duration as continuous extended wear will lead to discomfort due to the pressure from the temple.