fend icon indicating copy to clipboard operation
fend copied to clipboard

Overload `of` operator for percentages

Open printfn opened this issue 2 years ago • 0 comments

See https://github.com/printfn/fend/pull/165#issue-1337725749 by @Techcable:

Proposal to overload of

I propose overloading the of operator specifically to handle this case with percentages. We would have 5% of 100 == 5, while multiplication would give 500%. This would clear up any ambiguity (although I would probably file a separate issue/PR).

It should not cause issues with any other operations, since it would only activate when a percentage is on the left-side of the of operator (similar to how string concat is special-cased in many languages).

printfn avatar Aug 13 '22 00:08 printfn