agda-stdlib icon indicating copy to clipboard operation
agda-stdlib copied to clipboard

What should our explicit import policy be?

Open MatthewDaggitt opened this issue 1 year ago • 10 comments

As discussed in https://github.com/agda/agda-stdlib/pull/2334 we don't currently have a policy about when imports should use an explicit using statement and when it's fine to open the whole module. We should add something to the style guide.

I have no particularly strong feelings on the matter.....

MatthewDaggitt avatar Apr 01 '24 05:04 MatthewDaggitt

We certainly should allow explicit imports, even if they are long, and not remove them once they've been put into place.

To me, there should be some 'core' of the library where explicit imports are required, and an 'upper layer' where they are merely encouraged.

JacquesCarette avatar Apr 01 '24 12:04 JacquesCarette

I would argue in favour of mandatory explicit import lists if they mention, say, max half a dozen identifiers. Throwing these in as we touch modules should hopefully help us detect spurious dependencies (until we get better tooling to do it automatically).

gallais avatar Apr 03 '24 13:04 gallais

I'd be happy with mandatory for <= 6. I'd be unhappy to have explicit imports deleted just because they're long.

JacquesCarette avatar Apr 04 '24 00:04 JacquesCarette

I'd be happy with mandatory for <= 6. I'd be unhappy to have explicit imports deleted just because they're long.

NB some recent refactorings do indeed delete 'long' using directives, but usually only to localise them further by removing more names, or to distribute the names they do import over lower-level modules they import from... so I don't think there's unnecessary 'widening' of import interfaces going on here.

jamesmckinna avatar Apr 06 '24 20:04 jamesmckinna