Macaulay2 / Macaulay2/M2

hh cannot dispatch on the classes of more than one argument

Open
#4,546 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bugs directory
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

This issue was triaged from bugs/dan/0.5-hh-dispatch, one of the 857 files removed from the pre-GitHub bugs/ tree by d2c8d27826 and catalogued in #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
We should fix this for you in the next version of Macaulay2!  I.e, hh  
should allow dispatching on the classes of multiple arguments, as in  
hh^i(x,y), the way HH allows.

(Defining a method for hh(ZZ,Sequence) prevents someone else from  
doing so, and someone else might want to.)

On Nov 10, 2009, at 7:11 AM, René Birkner wrote:


    Ok, for just two arguments (i and the bundle) it works to define

    hh(ZZ,ToricVectorBundle) := ZZ => (i,E) -> (....)

    but if I want to add a degree vector I can not add another argument
    but

    hh(ZZ,Sequence) := ZZ => (i,S) -> (
    (E,u) := S;
    ...)

    works.
Where it stands today

Not done — and the file's premise turns out to be wrong too, which changes what should be fixed.

The state today

Varieties.m2:777 still builds the lookup key as a := (pq, X) with X the entire argument, so
hh^i(x,y) looks up (ZZ, Sequence). An installed hh(ZZ, X, Y) is therefore unreachable — calling it
errors with "no method available".

The premise does not hold

The file says hh should dispatch on multiple arguments "the way HH allows". It does not:
HH^2(x,y) fails identically. So both operators share the limitation, and a fix aimed at matching HH
would have nothing to match.

The consequence the file names is the real cost

Defining a method for hh(ZZ,Sequence) prevents someone else from doing so, and someone else might
want to.

That is the durable argument: with the key collapsing every multi-argument call onto (ZZ, Sequence),
the first package to install such a method claims the whole space, and a second package cannot coexist
with it. Dispatching on the classes of the actual arguments is what makes the operator extensible.

open · disposition issue · source of truth: bug-triage/catalog.tsv

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Varieties.m2 around line 777 and inspect how the lookup key is formed from the operator arguments. Reproduce hh^i(x,y) and HH^2(x,y), then verify dispatch using the classes of each argument rather than collapsing multi-argument calls to Sequence. Done means compatible methods with different argument-class combinations can coexist and be reached.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.