Are compile time generated, stable and unique IDs possible?

Steven Schveighoffer schveiguy at gmail.com
Fri May 8 13:45:13 UTC 2020


On 5/8/20 8:45 AM, Robert M. Münch wrote:
> Let's assume I have an GUI application and I want to record some 
> user-actions which can be replayed.
> 
> And this replay should be possible even if the application layout 
> changes. Hence, I somehow need to identify the run-time objects in a way 
> that this identification stays the same while the app is further 
> developed and between user sessions.
> 
> And I don't want to manually manage all IDs (initially) but use the 
> compiler for this.
> 
> Is there any way to generate such stable unique IDs at compile-time? I 
> can imagine that his maybe needs to be combined with a mixin that is 
> used inside a constructor to get IDs into run-time objects.
> 

The compiler needs something to go off of that isn't going to change 
between revisions. Maybe the fully qualified name? Then you can hash that.

-Steve


More information about the Digitalmars-d-learn mailing list