Skip to content

Clarify deprecation of ^^^ #11590

Closed
Closed
@QuinnWilton

Description

@QuinnWilton

Hello! In Elixir 1.12, ^^^ began outputting a deprecation warning:

iex(1)> import Bitwise
Bitwise
iex(2)> 3 ^^^ 5
warning: ^^^ is deprecated. It is typically used as xor but it has the wrong precedence, use Bitwise.bxor/2 instead
  iex:2:3

6

It isn't clear to me whether this warning is meant to indicate that ^^^ is deprecated entirely, or just in its use as a delegate for Bitwise.bxor/2. The fact that it calls out Bitwise.bxor/2 specifically makes me think that the deprecation is limited to that use, but the warning is output in all cases:

iex(1)> defmodule Operator do 
...(1)> import Kernel, except: [^^^: 2]
...(1)> def a ^^^ b, do: a + b
...(1)> end
warning: ^^^ is deprecated. It is typically used as xor but it has the wrong precedence, use Bitwise.bxor/2 instead
  iex:3:7

{:module, Operator,
 <<70, 79, 82, 49, 0, 0, 4, 248, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 140,
   0, 0, 0, 15, 15, 69, 108, 105, 120, 105, 114, 46, 79, 112, 101, 114, 97, 116,
   111, 114, 8, 95, 95, 105, 110, 102, 111, ...>>, {:^^^, 2}}
iex(2)> import Operator
Operator
iex(3)> 5 ^^^ 3
8
iex(4)> warning: ^^^ is deprecated. It is typically used as xor but it has the wrong precedence, use Bitwise.bxor/2 instead
  iex:3:3

nil
iex(5)> 

Note, also, that in the last snippet the warning is output after the result of the expression is printed, causing it to be rendered as part of the prompt for iex(4)>

I suppose my question is: is ^^^ going to be removed entirely in Elixir 2.0.0, and if so, should the warning be updated to reflect that more clearly?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions