Macaulay2 / Macaulay2/M2

needsPackage should be able to load a package without its unadorned symbols

Open
#4,502 0 comments 0 reactions 0 assignees View on GitHub
bugs directory Core
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

This issue was triaged from [`bugs/dan/0-needsPackage-unadorned`](https://github.com/Macaulay2/M2/blob/388c1ff0ce30d83751dea7bc7eac77fdc1305dd7/bugs/dan/0-needsPackage-unadorned), one of the 857 files removed from the pre-GitHub `bugs/` tree by [`d2c8d27826`](https://github.com/Macaulay2/M2/commit/d2c8d27826) and catalogued in [#36](https://github.com/Macaulay2/M2/issues/36). **The commentary below was written by Claude (Claude Opus 5, via Claude Code)**, not by @d-torrance, whose account posted it -- please weigh it accordingly.

### The original file, verbatim

```text
-- -*- M2 -*-

-- needsPackage and loadPackage need an optional argument, such as Using=>true. When true, behavior is as now.
-- When false, a different global dictionary is put on the dictionaryPath that has just the synonym symbols (containing
-- "$") in it.
```

### Where it stands today

`needsPackage` still has no `Using` option. Its options are `LoadDocumentation`, `Configuration`,
`FileName`, `Reload` and `DebuggingMode`.

### What the file asks for

`needsPackage(..., Using => false)`: load the package but put a dictionary on `dictionaryPath` holding
only the **synonym** symbols — the ones containing `$` — so the package's names are reachable
explicitly (`foo$Pkg`) without being dumped into scope unadorned.

### Why it is worth having

This is the missing middle between the two options that exist. `PackageImports` loads without
importing symbols at all; `PackageExports` imports them *and* re-exports them to your own users. There
is nothing that says "I want these names, but only via their qualified spellings, and I am not passing
them on" — which is exactly what a package author wants when a dependency's names collide with their
own.

**#4537** is the sweep that trips over this gap: 34 packages still use `needsPackage` because neither
existing option does what they need.

### Notes for whoever picks this up

The synonym symbols already exist — the shadowing warning M2 prints ("use the synonym `graph$0`")
depends on them — so this is about which dictionary goes on the path rather than about creating new
names.

`open` · disposition `issue` · source of truth: [`bug-triage/catalog.tsv`](https://github.com/d-torrance/M2/blob/bug-triage/bug-triage/catalog.tsv)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the needsPackage entry point and review its existing options, especially PackageImports and PackageExports, to understand how dictionaries are placed on dictionaryPath. Implement the Using => false behavior so only synonym symbols remain reachable through qualified names, then verify that unadorned package symbols are not imported.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.