-
Notifications
You must be signed in to change notification settings - Fork 340
Generic parameter #7730
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
Open
jenshnielsen
wants to merge
9
commits into
microsoft:main
Choose a base branch
from
jenshnielsen:generic_parameter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+213
−90
Open
Generic parameter #7730
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
be44aa7
Make ParameterBase and Cache use Generic arguments
jenshnielsen 0d225ab
Make InstrumentType covariant
jenshnielsen aa9f0bd
Add missing overload to keep mypy happy
jenshnielsen 6c8e877
Make Parameter classes take generic arguments
jenshnielsen 5404067
Make ParameterWithSetpoints accept generic arguments
jenshnielsen 7fb83c0
Make ArrayParameter accept generic arguments
jenshnielsen a6e0083
Make MultiParameter accept generic arguments
jenshnielsen 26d86fa
Make DelegateParameter generic
jenshnielsen a28f919
Add changelog for 7730
jenshnielsen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| The QCoDeS Parameter classes ``ParameterBase``, ``Parameter``, ``ParameterWithSetpoints``, ``DelegateParameter``, ``ArrayParameter`` and ``MultiParameter`` now | ||
| takes two Optional Generic arguments to allow the data type and the type of the instrument the parameter is bound to to be fixed statically. This enables | ||
| the type of the output of ``parameter.get()``, input of ``parameter.set()`` and value of ``parameter.instrument`` to be known statically such that type | ||
| checkers and IDE's can make use of this information. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to agree on this order of generic arguments before merging since changing this would be a breaking change for all Parameter usage and implementations.
Roughly there are four relevant generic parameters for an instrument.
Here I propose that we add 1 and 2 but omit 3 and 4 for the time being.
That is a tradeoff between the features and the amount of parameters
that needs to be passed to each generic Parameter since currently if
one generic parameter is supplied to a Generic function/class they must all be supplied.
This, however, also means that we cannot add these in a non-breaking way before we drop 3.12 support.
In 3.13 onwards it becomes possible to omit values for type parameters that have default values so we can simply append these and omit them when they don't add value