1. Can you please give examples of real world scenarios where SETs could be best used?
Flags, mostly. The IDE, LCL and compiler source code is full of it.
Have you ever used it? What were you developing? What did you use it for? Did it make things easier?
Other languages, for eg. C don't have this feature, imo Subrange and SET are indeed great features of Pascal, but i don't have any idea where it could be used?
Yes. GUI wrappers, games, some other "common" apps. For example, in games, sets are useful for player's bad status (poisoned, paralyzed, petrified, etc.). Empty set denotes normal / healthy condition. It not only makes things easier, but set operations are damn fast at instruction level. Those who aren't used to sets will probably do this:
function TPlayer.CanMove: Boolean;
begin
Result := (Player.Status = psPoisoned) or (Player.Status = psParalyzed) or (Player.Status = psPetrified);
end;
That's a few CMP + JZ instructions (without optimizer). With sets, it can be turned into:
function TPlayer.CanMove: Boolean;
begin
Result := Player.Status in [psPoisoned,psParalyzed,psPetrified];
end;
Which is not only shorter at source code level, but at instruction level only generates (probably) single AND + JNZ instruction. Shorter and faster, double benefit. C might not have sets, but C programmers can have it by carefully using bit operations against typedef-ed integer type and probably some enum or #define. Still, the programmer's responsibility is way higher (ensuring no value outside allowed range) and having 256 elements set will not be a trivial operation.
(While it doesn't matter since it's all translated to Assembly anyway, but still asking just out of curiosity.. which one is the original (as Writh designed it)?
The original Pascal has no way to override the ordinal value. Wirth designs the type as a high level type, as how you would use it in math, not computer interfacing.