digitalmars.D.learn - Are compile time generated, stable and unique IDs possible?
- =?iso-8859-1?Q?Robert_M._M=FCnch?= (15/15) May 08 2020 Let's assume I have an GUI application and I want to record some
- Steven Schveighoffer (4/19) May 08 2020 The compiler needs something to go off of that isn't going to change
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. -- Robert M. Münch http://www.saphirion.com smarter | better | faster
May 08 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
May 08 2020