May 08, 2020 Are compile time generated, stable and unique IDs possible? | ||||
---|---|---|---|---|
| ||||
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 Re: Are compile time generated, stable and unique IDs possible? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert M. Münch | 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
|
Copyright © 1999-2021 by the D Language Foundation