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

Add support for changing global variables in versions #5

Closed
zmievsa opened this issue Aug 26, 2023 · 2 comments
Closed

Add support for changing global variables in versions #5

zmievsa opened this issue Aug 26, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@zmievsa
Copy link
Owner

zmievsa commented Aug 26, 2023

Is your feature request related to a problem? Please describe.
Often things like error messages and status codes are also versioned. We want some solution that allows us to change any variables in-between API versions.

Describe the solution you'd like
I'm thinking of the following interface:

from cadwyn.structure import module

module(latest.my_module).variable("some_variable").had(value="'hello darkness'", annotation="str")

which will generate the following code:

# within latest.my_module

some_variable: str = 'hello darkness'

Do we really need this though? I am worried that this might be an overkill that will add hidden side effects.

For the sake of simplicity, we won't allow defining variables in-between versions — only changing their values and annotations.

@m0n0x41d
Copy link
Contributor

I am taking it

@zmievsa
Copy link
Owner Author

zmievsa commented Dec 21, 2023

I thought about it once again: this is a bad idea. Instead, if-statements with side effects are a much safer choice.

This functionality would render side effect detection useless and will significantly complicate tests of business code so its value is not enough to justify its complexity.

@zmievsa zmievsa closed this as completed Dec 21, 2023
@zmievsa zmievsa closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants