Skip to content

Conversation

@nsajko
Copy link
Contributor

@nsajko nsajko commented Sep 8, 2025

As documented, the intended way to implement > is to add a method to <. Similarly with >=. A package should never add a method to either > or >=.

As documented, the intended way to implement `>` is to add a method to
`<`. Similarly with `>=`. A package should never add a method to either
`>` or `>=`.
Copy link
Member

@odow odow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming the fallbacks work

nsajko and others added 3 commits September 8, 2025 06:10
Correct error message for variable comparison in Julia.
Correct error messages in nonlinear.md for clarity.
julia> f(x)
ERROR: Cannot evaluate `>` between a variable and a number.
ERROR: Cannot evaluate `<` between a variable and a number.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only downside. We might talk about < when the user wrote >.

@odow
Copy link
Member

odow commented Sep 8, 2025

Aside from recommended practice, what is the motivation for this?

@codecov
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4056c00) to head (b58a1c0).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #4065   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           43        43           
  Lines         6201      6201           
=========================================
  Hits          6201      6201           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nsajko
Copy link
Contributor Author

nsajko commented Sep 8, 2025

Aside from recommended practice, what is the motivation for this?

This PR, together with PR JuliaDiff/ForwardDiff.jl#771, greatly decreases the amount of sysimage invalidation on using JuMP:

EDIT: the above is with nightly (v1.13) Julia, JuliaLang/julia@865b8be

@nsajko
Copy link
Contributor Author

nsajko commented Sep 8, 2025

Status with this PR, but without PR JuliaDiff/ForwardDiff.jl#771:

So an improvement, but not as much as with PR JuliaDiff/ForwardDiff.jl#771.

@nsajko
Copy link
Contributor Author

nsajko commented Sep 8, 2025

NB: if you want to reproduce the above results, do using JuMP without loading anything (other than SnoopCompileCore) before. Not even the REPL or Pkg (both load StyledStrings which does piracy so causes invalidation, changing the results).

@odow
Copy link
Member

odow commented Sep 8, 2025

Invalidation is a good reason

@odow odow merged commit 21a9c01 into jump-dev:master Sep 8, 2025
10 checks passed
@nsajko nsajko deleted the prevent_adding_methods_fix branch September 8, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants