Modern Cars tend to have disc brakes .Vintage and Classic Cars ted to have drum brakes.Disc brakes perform better and therefore are deemed safer .In fact disc brake conversions are applied to some classic cars.Why is it that trucks still persist with drumbrakes?
It's not really fair to say as a general statement that disc brakes perform better than drums.
Brake effectiveness depends largely on the "swept" or contact area. In a truck, the shoes "liners" and drums are huge - far more surface area in contact than a pair of brake pads.
It is true disc brakes offer many advantages: compact, ease of maintenance, constantly self-adjusting for wear, cooling, and reduction of unsprung and rotating mass at each wheel. Discs are the choice for modern performance vehicles.
However, provided the braking forces are equal, there is nothing inherently less "safe" using well-adjusted and maintained drum braking systems. On a truck with air brakes, the braking force is accomplished with mechanical springs. The air pressure removes the braking force and allows the truck to move. If there is a failure, the brakes default to being applied. With a hydraulic disc system, a hydraulic failure can lead to no brakes at all.
One more salient point: discs transfer heat a lot better into the fluid, which can boil and make braking next to useless. Drums have a lot of isolation from the fluid as the only real contact is the shoe tabs or pushrods against the cylinder pistons.
Trucks are vehicles that carry significant loads on the bed or on towed trailers. Correctly sized leaf springs work better in those situations over coil springs. Leaf springs also negate the need for trailing rods etc, so work well in the back.
Disk brakes are better at stopping from high speed, drum brakes are better at stopping heavier loads from lower speed. (assuming everything's correctly adjusted etc)
Disks are lighter and cool down faster, which is good for a car (race or otherwise) but for a heavy vehicle.
Answer Drums are sometimes a better choice than disk brakes, all things considered.
Drums feature on 4WD vehicles for long while after cars went disks. Again, the requirement of stopping heavier loads from slow speed is more of an advantage than hauling down from open road speeds.
In addition, a drum can survive impacts that would damage a disk brake rotor, so less likely to be stranded in the back-country.
Last advantage is pricing - disks cost more to make than drum brakes, so particularly cost-conscious products may be specified with whatever's cheapest.
One thing that hasn't been mentioned in other answers is the service life. Drum brakes that are properly set up can last multiple times longer than comparable disk brakes.
For trucks that drive longer distances, increasing the service interval is a significant cost-saving measure.
I've came back and remembered yet another thing: handbrakes. It's much harder to include a cable-operated handbrake into a disk brake system (although it's obviously been done). IIRC at least in the US the regulations require that it must be cable operated (so that a potential fluid leak couldn't let the car loose). This is one of the reasons for drum brakes persisting in the cheaper and smaller cars as well.
For the front wheels that perform nearly all of the braking and take the largest forces discs are what you want. For the rear drum brakes are good enough. You never, never, never see drums on the front of a modern vehicle. Never.
Disc brakes also cost more and drums are adequate. So cost cutting may just be the greatest motivator.
To add my experience to these already great answers, drum brakes are far less likely to be affected by salt and road debris. I had a small Honda SUV for a decade in Chicago, where the salt in winter would rust and seize the rear brake pads nearly every year due to receiving the brunt of the salt spray. I replaced and rebuilt the rear brakes four times compared to the front's once. Drum brakes on rear wheels on lighter vehicles are less maintenance overall, and rear brakes do far less work than the front brakes do by the nature of physics and the proportional design so they don't need to be as robust.