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

2.0 Replace infix in #54106

Open
jariji opened this issue Apr 16, 2024 · 2 comments
Open

2.0 Replace infix in #54106

jariji opened this issue Apr 16, 2024 · 2 comments
Labels
design Design of APIs or of the language itself speculative Whether the change will be implemented is speculative
Milestone

Comments

@jariji
Copy link
Contributor

jariji commented Apr 16, 2024

Infix in acts like almost nothing else in the language: having only letters in its name, it looks like a normal variable, but it has an unexpected infix syntax.

Some ideas

  • Use in(x, xs) instead.
  • Use instead of in. This is annoying to type on websites.
  • Use the Haskell syntax where backticks make a function into an infix operator
> f x y = x + y
> f 1 2
3
> 1 `f` 2
3
@DNF2
Copy link

DNF2 commented Apr 16, 2024

It's not so unexpected, though, since it shows up in every for loop as for i in eachindex(a) etc. I also think replacing an ascii operator with a mandatory unicode version is a non-starter.

As for other similar constructs, there's also isa.

@jariji
Copy link
Contributor Author

jariji commented Apr 16, 2024

Right, in and isa, I think these are the only two.

But it's not a mandatory unicode: you can do in(x, xs).

As for for i in eachindex(xs) that's not using the in operator, it's a separate syntax.

@mbauman mbauman added the speculative Whether the change will be implemented is speculative label Apr 16, 2024
@LilithHafner LilithHafner added this to the Potential 2.0 milestone Apr 16, 2024
@nsajko nsajko added the design Design of APIs or of the language itself label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design of APIs or of the language itself speculative Whether the change will be implemented is speculative
Projects
None yet
Development

No branches or pull requests

5 participants