Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNM: Fix and test support for Σ, ∑,and ∏ #3536

Closed
wants to merge 1 commit into from

Conversation

odow
Copy link
Member

@odow odow commented Oct 6, 2023

Closes #3533

We've always supported Σ, ∑,and ∏, but these weren't tested, and the only worked for generators, not with a single itterable argument.

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (4a716c3) 98.25% compared to head (2830c07) 98.25%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3536   +/-   ##
=======================================
  Coverage   98.25%   98.25%           
=======================================
  Files          37       37           
  Lines        5563     5569    +6     
=======================================
+ Hits         5466     5472    +6     
  Misses         97       97           
Files Coverage Δ
src/macros.jl 98.02% <100.00%> (+0.01%) ⬆️

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

@blegat
Copy link
Member

blegat commented Oct 6, 2023

Is that an issues with MutableArithmetics, it seems that it is always using _is_sum

@odow
Copy link
Member Author

odow commented Oct 6, 2023

The generator case is handled here:
https://github.com/jump-dev/MutableArithmetics.jl/blob/37bb9bfc792dd305ef971992c601ebea9f9812e3/src/rewrite_generic.jl#L76

But maybe we shouldn't support this. \sum and \Sigma aren't defined objects in Julia, so it will conflict if someone defines their own \sum function.

The problem is really that MutableArithmetics should not have tried to be clever with unicode

@odow
Copy link
Member Author

odow commented Oct 6, 2023

Doc failure is #3538

@blegat
Copy link
Member

blegat commented Oct 6, 2023

I see, when it's going through this code then it works but when it's just gets executed as is then it fails.
I guess the issue with this PR is if the user does

julia> Σ = 1
1

and then uses that in its macro. Then if you replace it with sum, that's an issue because it's not 1 anymore.
Maybe MA shouldn't do what it does. I think that comes from a copy-paste of the old rewriting code from JuMP.

@odow
Copy link
Member Author

odow commented Oct 7, 2023

Maybe MA shouldn't do what it does. I think that comes from a copy-paste of the old rewriting code from JuMP.

Yeah

@odow odow changed the title Fix and test support for Σ, ∑,and ∏ DNM: Fix and test support for Σ, ∑,and ∏ Oct 7, 2023
@odow odow marked this pull request as draft October 7, 2023 12:47
@odow
Copy link
Member Author

odow commented Oct 9, 2023

I think I'm going to close this as won't-fix. The \Sigma isn't documented, so it's mostly a legacy quirk. We should encourage people not to use it.

@odow odow closed this Oct 9, 2023
@odow odow deleted the od/unicode-sum-prod branch October 9, 2023 08:17
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.

Use of Σ is not consistent
2 participants