I am attaching my first stab at resource identification (still buggy, beware).
Here is how it works:
when parsing a resource statement, check if an identical resource already exists.
"identical" is defined as most constructor arguments being equal, including name, parameters, virtual-ness...
At this stage, it is important that no overrides have been applied, otherwise resources could change and cease to be identical.
When calling Resource.finish , overrides are applied normally.
The criteria for identical-ness work for both resources and overrides; an override can be equal to another if both specify exacly the same parameters (an override cannot be identical to a plain resource).
Examples coming later.