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 Note.major, .minor getters that return a Tonality #108

Closed
albertms10 opened this issue May 12, 2023 · 0 comments · Fixed by #124
Closed

Add Note.major, .minor getters that return a Tonality #108

albertms10 opened this issue May 12, 2023 · 0 comments · Fixed by #124
Assignees
Labels
enhancement New feature or request refactor The code needs to be refactored
Milestone

Comments

@albertms10
Copy link
Owner

albertms10 commented May 12, 2023

Description

  • Add .major and .minor getters to the Note class.
  • (optional) Replace static constant constructors with these getters.

Example

Before:

const tonality1 = Tonality(BaseNote.fSharp, TonalMode.major)
const tonality2 = Tonality.dMinor

After:

final tonality1 = Note.fSharp.major
final tonality2 = Note.d.minor

Advantages

  • More expressive API.
  • Can express any argument combination for a Tonality instance without declaring specific static constant constructors.

Drawbacks

  • Cannot be used in constant contexts.

Acknowledgements

@plammens for suggesting the change.

@albertms10 albertms10 added refactor The code needs to be refactored enhancement New feature or request labels May 12, 2023
@albertms10 albertms10 added this to the Road to 0.7 milestone May 12, 2023
@albertms10 albertms10 self-assigned this May 13, 2023
@albertms10 albertms10 linked a pull request May 14, 2023 that will close this issue
@albertms10 albertms10 removed their assignment May 16, 2023
@albertms10 albertms10 removed this from the Road to 0.7 milestone May 16, 2023
@albertms10 albertms10 self-assigned this May 16, 2023
@albertms10 albertms10 added this to the Road to 0.7 milestone Dec 27, 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 refactor The code needs to be refactored
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant