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

Use options instead of extra arguments? #131

Open
mtorpey opened this issue Sep 3, 2024 · 0 comments
Open

Use options instead of extra arguments? #131

mtorpey opened this issue Sep 3, 2024 · 0 comments
Labels
discussion Not exactly an issue to be resolved, but a discussion about the future of the package

Comments

@mtorpey
Copy link
Collaborator

mtorpey commented Sep 3, 2024

In GAP, there seem to be 3 main ways we alter the behaviour of a function:

  1. Passing additional optional arguments, as in InstallPackage("digraphs", true)
  2. Using the option stack, as in InstallPackage("digraphs" : keepDirectory)
  3. Passing an options record, as in Test("myfile.tst", rec(width := 90, rewriteToFile := true))

Unfortunately, the package manager has got itself into a state where it's doing both 1 and 2 for different things, as shown above. I want to nip this in the bud and come up with something consistent. My thoughts are:

  1. Optional arguments are awkward when we start adding more and more fields. Already version and interactive are only distinguishable because they have different types, and it's getting messy handling them.
  2. The option stack has nice syntax and obvious names, and I'm leaning towards this being the "right" way. But is there any weird behaviour I should worry about?
  3. Options records are foolproof – this would be my second preference.

I plan to pick just one mechanism now and refactor the package to use it, either removing or deprecating other things that already exist. This might fit well with an overall transition to a more sane codebase and a 2.0 release where I fix some other stuff.

Is there any reason not to switch to using the options stack?

@mtorpey mtorpey added the discussion Not exactly an issue to be resolved, but a discussion about the future of the package label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Not exactly an issue to be resolved, but a discussion about the future of the package
Projects
None yet
Development

No branches or pull requests

1 participant