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

Purpose of \cdot? #596

Open
rben01 opened this issue Oct 1, 2024 · 1 comment
Open

Purpose of \cdot? #596

rben01 opened this issue Oct 1, 2024 · 1 comment

Comments

@rben01
Copy link
Contributor

rben01 commented Oct 1, 2024

There is a unicode input shortcut \cdot that expands to U+22C5 Dot Operator. It seems like this should be a multiplication operator, but instead it's parsed as an identifier character.

>>> let x⋅ = 2  # x\cdot

  let x⋅: Scalar = 2

It is not present in the match arm here:

'*' | '·' | '×' => TokenKind::Multiply,

Should it be? Or should \cdot expand to the same thing as \cdotp, U+00B7 Middle Dot?

@sharkdp
Copy link
Owner

sharkdp commented Oct 2, 2024

The Unicode input feature is inspired (copied?) from julia (https://docs.julialang.org/en/v1/manual/unicode-input/), and they turn \cdot into U+22C5, so I think we should leave it this way.

I basically just added a couple of characters that I thought could be useful (in the future) for Numbat. I didn't care if they already have a purpose right now.

I think it would be sensible to include it in the TokenKind::Multiply match arm though? If we do so, let's also update the documentation / syntax highlighting stuff that might refer to different multiplication operators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants