Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

how do we handle traits in global state without an explosion of type declarations? #148

Closed
thedavidmeister opened this issue Jul 18, 2018 · 2 comments

Comments

@thedavidmeister
Copy link
Contributor

i had this problem while trying to put a chain and/or hash table in the agent state

because we want to implement our memory/file/db storage of data as a trait, AgentState complains about type declarations unless we do something like box the trait

when we box the trait, it's much harder to do things like clone/reference/etc.

when we put the type declarations on AgentState, then it complains about type declarations on State, which then complains about type declarations on Persister, which then complains about a half dozen other type declarations...

i assume that we'll have the same problem with any trait, e.g. if we want the network interface to support bluetooth/wifi/etc. and then try to put it in the global state, we will suddenly have to start declaring the network type everywhere too

in the short term i commented out the usage of source chain straight from the agent state

@StaticallyTypedAnxiety
Copy link
Contributor

I appologize if my suggestion has already been done before, but would bounded generics help?

@thedavidmeister
Copy link
Contributor Author

@AshantiMutinta the answer was actors in the end #226

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants