Skip to content
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

generic.NewResource should add zero value #57

Open
delaneyj opened this issue Feb 28, 2024 · 2 comments
Open

generic.NewResource should add zero value #57

delaneyj opened this issue Feb 28, 2024 · 2 comments

Comments

@delaneyj
Copy link

delaneyj commented Feb 28, 2024

When creating sys.timeRes = generic.NewResource[Time](w) I'd expect the zero value to be present, but its a nil value causing a panic. Maybe should be an upsert of zero value if resource doesn't already exist?

@mlange-42
Copy link
Owner

As resources can be added and removed dynamically, IMO it makes sense to indicate absence by nil.

@delaneyj
Copy link
Author

maybe then generic.UpsertResource[Time](w)?

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

No branches or pull requests

2 participants