Skip to content

Move get_hinted_aff_expr out of IOM (unexported, and IOM never calls it) #224

Description

@rodrigomha

Raised by @luke-kiernan reviewing #206:

organizational nitpick: get_hinted_aff_expr is non-exported, but the only places that call it are in POM. Move to POM or export it

Deferred out of #206 because that PR should not touch IOM. Filing so it does not get lost.

Verified state

get_hinted_aff_expr is defined in IOM at src/utils/jump_utils.jl:10.
It is three lines: JuMP.AffExpr(0.0) plus a sizehint!.

  • Not exported. It appears in none of the ~289 export lines in src/InfrastructureOptimizationModels.jl.
  • IOM never calls it. A full-tree grep for hinted across IOM src, test and docs returns only the definition itself. It is dead code inside its own package.
  • Every caller is POM, six sites, all IOM.-qualified:
    • src/ac_transmission_models/AC_branches.jl:776
    • src/ac_transmission_models/AC_branches.jl:798
    • src/services_models/reserves.jl:145
    • test/test_ac_transmission_security_constrained_models.jl:116
    • test/test_ac_transmission_security_constrained_models.jl:234
    • test/test_ac_transmission_security_constrained_models.jl:333
  • Not in InfrastructureSystems.
  • PowerSimulations has its own private copy at src/utils/jump_utils.jl:3. It is not a consumer of IOM's, so it does not constrain the decision.

Note this is not one of the IOM._* underscore helpers POM reaches into.
It is a public-looking name that happens to be unexported, which is arguably worse for discoverability than an explicit underscore.

Options

Move it to POM (preferred). Put it in POM src/utils/, drop the IOM. qualifier at the six sites, and delete it from IOM in a companion PR.
The function has no IOM caller to break, so this is a clean removal rather than a deprecation.

Export it from IOM. Cheaper, but it publicizes a function IOM itself has no use for, which is the wrong signal about where the abstraction belongs.

Sequencing

Two PRs, POM first so IOM is never the broken side:

  1. POM: add the definition locally, switch the six call sites, keep working against current IOM.
  2. IOM: delete get_hinted_aff_expr from src/utils/jump_utils.jl.

Related to the broader concern that POM currently calls ~56 non-exported IOM._* helpers, an informal but load-bearing surface.
This one is a small, self-contained instance of the same boundary question.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions