Accessing static data of functions
timon.gehr at gmx.ch
Tue Oct 19 11:15:42 UTC 2021
On 19.10.21 10:15, Ogi wrote:
> What are we talking about is not a game but an engine to be used for
> making different games, potentially by people other than me. So this is
> a limitation that the users will have to be aware of and work around it,
> and failing to do so will result in silent bugs in their code because
> there’s no way to enforce it at compile time.
Without the necessary language extension, what you could do as a
workaround is require all functions in the plugin to be `pure`. Then
they can't access static variables. Of course that also rules out
accessing globals, so you'd have to pass around global state explicitly
within some object.
More information about the Digitalmars-d