-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy dependent Object initialization #922
Comments
The best input I can offer at this point is that it definitely is interesting! |
I even thought about using a data descriptor pattern, but that'd make it more complex to pass parameters to them. Option 3 would be: class MyCharm(CharmBase):
foo = FooLib(*static_params)
bar = BarLib(*static_params)
def __init__(self, f):
f.observe(self.foo.on_event, self._on_foo_event)
f.observe(self.bar.on_event, self._on_bar_event)
self.foo.setup(*dynamic_params)
self.bar.setup(*dynamic_params) |
That's a very interesting constraint. |
I like it @PietroPasotti, it's a step in the right direction. |
This piques my interest, but I think I'm missing a chunk of context:
Did you intend for Yeah, we'd have to check whether the GC would do what we expect here. There's some usage of weak references in the |
Not so simplified, but:
|
@benhoyt I'm proposing a new pattern. Option 3 also involves adding to Yes, |
This is an interesting discussion, but charmers can implement this now in charms if they want. Also, I'm unsure whether this solves the ordering issue -- it doesn't seem like it would. Feel free to re-open if there's a more concrete proposal or further thoughts. |
So here's a swanky Monday idea:
TLDR: proposing a new pattern: put all Objects depending on charm in a property:
Now:
Issues with this pattern:
Proposal:
What this gains us:
Questions:
The text was updated successfully, but these errors were encountered: