We have:
- a
uResourceTableFields.pas
unit defining consts for fieldnames
this containedSHours = 'tt_hours';
- a
uResource.pas
unit containing resourcestrings
These are use for the UI and are subject to translations
I added
SHours = 'Uren';
to uResource.pas
and this compiled fine.
The next day I noticed code like
Result := AllocationData.FieldByName(SHours).AsFloat;
failed with 'field not found' ;-)
The resourcestring was substituted here!
How can we automatically prevent these kinds of conflicts at compile time?
It is not possible to limit our Uses clauses to either uResourceTableFields
or uResource
.