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

Unicode operators #58

Open
Roman-Kerimov opened this issue Nov 8, 2019 · 5 comments
Open

Unicode operators #58

Roman-Kerimov opened this issue Nov 8, 2019 · 5 comments
Labels
wontfix This will not be worked on

Comments

@Roman-Kerimov
Copy link

Since Swift supports Unicode in identifiers, it is possible to improve the appearance of the code by adding aliases for operators, such as: × ⋅ ÷ ∶ (RATIO) - (MINUS SIGN), etc.

What do you think of it?

@xwu
Copy link
Contributor

xwu commented Nov 9, 2019

I think it would be perfectly fine for a developer who prefers this spelling to create a third-party library to vend these operators. However, Swift has standardized on a certain spelling for operators. This issue has already been discussed on Swift Evolution in the past and I don't see how the design of existing standard library operations would fall into the scope of Swift Numerics.

@stephentyrone
Copy link
Member

Basically what Xiaodi said.

The one place where I might consider a novel operator in the medium-term future would be around matrix multiplication (where we have a very real need to have a symbol for both the composition of linear maps--normal matrix multiply--and the Hadamard--or elementwise--product). Even there, though, the most obvious and precedented solution is * and .*, so I'm relatively unlikely to look to unicode unless there's a truly great option.

@stephentyrone stephentyrone added the wontfix This will not be worked on label Nov 11, 2019
@stephentyrone
Copy link
Member

I'm marking this wontfix for the medium term. It's something we might consider in the far-off future.

@NevinBR
Copy link
Contributor

NevinBR commented Nov 20, 2019

I agree that we should stick to ASCII operators for the foreseeable future. However, just as a point of reference, I have been using a number of operators in my personal code, to write things like this:

let a = √2
let b = 1/√2
let c = -√2
let d = √-c
let e = 2√3
let f = (1+√5)/2

…and I also have:

typealias ℂ = Complex<Double>

@stephentyrone
Copy link
Member

I would be open to a "cute operators" module at some future point; they really do make reading some code much nicer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants