I accidentally pulled the plug while the lamp was still on.
This has also happened to me with the laptop charging cable (while it was connected.)
Can the device or the socket be damaged?
No. Nothing happens there. You can always do it and even then nothing happens.
Same consequence → electricity is gone. Only elsewhere on the circuit. It doesn't matter whether you interrupt the circuit at the socket or the switch.
With the PC it looks different because there's e.g. A system that has to shut down in order not to damage it.
That doesn't matter because the switch has a higher switching capacity at its contact than if you use the socket as a switch. The switch can withstand the sparks much better than the socket and the latter will break over time if it is always pulled under load.
If that happens a few times, that's no problem; but you should, if possible, pull the plug out of the socket when it is switched off.
A socket may be fused with 16A. Why should this break when a table lamp with 3W LED light is switched off with the plug. Why should the contacts of socket and plug be less resilient than switches? You have to buy the cheapest plugs at the backyard hardware store.
You have to switch off a motor that draws 16A under full load at the plug.
Where do the 3W LED lights come from now? I haven't written anything about it! The contacts of switches have a special coating for this purpose; that should be known! And the contacts of a socket outlet are not like the contacts of switches!
No, the devices can cope with that…
pc or so already more difficult: because it crashes…
on such large machines as firewood saws etc. A warning is stuck to the plug
do not pull under load
whatever the lamp or laptop needs, it doesn't matter
Not you, but the questioner wrote something about a table lamp. And that's what it's about. We're not talking about a 2300W consumer here.