Supporting syntax `x not in y` as alias for `!(x in y)`

… and has always been, apparently. thanks for the reminder!

julia> VERSION
v"0.3.12"

julia> ∉
∉ (generic function with 1 method)
2 Likes

I think it would. You can define tanpi, but that’s ok; since it’s not an operator. notin isn’t the best variable name, but you want it to still work if used. Assuming you couldn’t redefine, no more than:

julia> import Base.∉

julia> ∉ = 1
ERROR: cannot assign variable Base.∉ from module Main

It just mixes very awkwardly with in. It would be so much narural with !in.

I agree it would be a good addition, but I prefer the style of in for iteration, for inclusion, = only for assignment, I saw that suggested somewhere as good style and happen to agree. That would mean that is only paired with , since for !(i in iterator) isn’t going to get you much of anything you want.

Iteration is assignment. Each time around the loop it assigns the loop variable.

I don’t disagree with what you’re saying, but did what I said actually strike you as unclear? It seems perfectly obvious what I mean, in context: assignment which isn’t a part of an iterated loop.

It seems better to have one syntax for assignment. I don’t see the benefit of adding a special syntax for assignment specifically for one particular context when it behaves exactly the same as a normal assignment.

That ship sailed a long time ago.

Great. I withdraw my plan to review your code and make you conform to my chosen style. It was a mistake to propose it in the first place.

I don’t understand your point. If you want to use as variable name, just don’t import the base version (and don’t refer to it)?

It’s the same with anything:

julia> import Base.tanpi

julia> tanpi = 1
ERROR: cannot assign a value to imported variable Main.tanpi