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

Feature request: default flags in .agda-lib file #3118

Closed
jespercockx opened this issue Jun 8, 2018 · 5 comments · Fixed by #4942
Closed

Feature request: default flags in .agda-lib file #3118

jespercockx opened this issue Jun 8, 2018 · 5 comments · Fixed by #4942
Assignees
Labels
type: enhancement Issues and pull requests about possible improvements ux: library management Issues relating to the library management system ux: options Issues relating to Agda's command line options
Milestone

Comments

@jespercockx
Copy link
Member

It would be nice if we could put some default flags for an entire library in its .agda-lib file, like for Cabal. For example this would be very useful for --without-K or --safe. Or is there already an easy way to get the same effect?

@jespercockx jespercockx added type: enhancement Issues and pull requests about possible improvements ux: library management Issues relating to the library management system labels Jun 8, 2018
@jespercockx jespercockx added this to the 2.5.5 milestone Jun 8, 2018
@jespercockx jespercockx modified the milestones: 2.6.0, 2.6.1 Nov 15, 2018
@gallais gallais added the ux: options Issues relating to Agda's command line options label Aug 2, 2019
@jespercockx jespercockx modified the milestones: 2.6.1, 2.6.2 Dec 1, 2019
@nad
Copy link
Contributor

nad commented Apr 27, 2020

I think that the flags should only apply to the modules in the given library, not to the dependencies. See also #4029 and #2770, and perhaps #4272.

@jespercockx
Copy link
Member Author

I've been trying to implement this. The main issue seems to be that currently, the only thing .agda-lib files do is add some implicit command-line options to the call to the agda executable. However, if we would treat flags in the .agda-lib file as command-line flags, that means the flags are applied to all imports, including those from outside the library. Worse, importing a library with default flags would also apply those flags to the current file. This is not the behaviour we'd want.

Instead we want the library flags to only apply to the things in the current library, and let the (co)infection rules do their job for flags such as --safe or --rewriting. However, this seems to require adding the concept of a "library" to Agda proper, rather than just the preprocessor for command-line flags which we have currently. This takes away a bit from the "lightweight" aspect of the current approach, but that's not necessarily a bad thing.

@jespercockx
Copy link
Member Author

One problem is that the current approach searches for an .agda-lib file once per call to the agda executable, the new approach would do this once per file that is checked. So any performance problems (such as #4526) would suddenly get a lot worse. We might try to cache the results of looking for the .agda-lib file if that becomes a problem in practice.

@gallais
Copy link
Member

gallais commented Sep 23, 2020

We are already storing information about the directories in scope for
import resolution. Each one could come with a set of options attached
to it.

jespercockx added a commit to jespercockx/agda that referenced this issue Sep 25, 2020
jespercockx added a commit to jespercockx/agda that referenced this issue Sep 25, 2020
jespercockx added a commit to jespercockx/agda that referenced this issue Sep 25, 2020
jespercockx added a commit to jespercockx/agda that referenced this issue Sep 25, 2020
jespercockx added a commit to jespercockx/agda that referenced this issue Sep 25, 2020
jespercockx added a commit that referenced this issue Sep 25, 2020
jespercockx added a commit that referenced this issue Sep 25, 2020
@andreasabel
Copy link
Member

Thanks, @jespercockx !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Issues and pull requests about possible improvements ux: library management Issues relating to the library management system ux: options Issues relating to Agda's command line options
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants