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

math: Make function parentheses optional #7877

Merged
merged 5 commits into from Mar 30, 2021

Conversation

faho
Copy link
Member

@faho faho commented Mar 29, 2021

It's a bit annoying to use parentheses here because that requires
quoting or escaping.

This allows the parens to be omitted, so

math sin pi

is the same as

math 'sin(pi)'

Function calls have the lowest precedence, so

math sin 2 + 6

is the same as

math 'sin(2 + 6)'

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

It's a bit annoying to use parentheses here because that requires
quoting or escaping.

This allows the parens to be omitted, so

math sin pi

is the same as

math 'sin(pi)'

Function calls have the lowest precedence, so

math sin 2 + 6

is the same as

math 'sin(2 + 6)'
@faho faho added this to the fish 3.3.0 milestone Mar 29, 2021
@ridiculousfish
Copy link
Member

Nice! This would benefit with tests for nested calls and mixed arities, e.g. math 'sin cos 3' and math 'pow sin 3 5'

Call me Nikola Testla
@faho faho merged commit ed9268f into fish-shell:master Mar 30, 2021
@faho faho deleted the math-optional-parens branch March 30, 2021 15:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants