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

fix: use :erlang.bxor/2 instead of Bitwise.bxor/2 #18

Merged
merged 2 commits into from
Jul 2, 2021
Merged

Conversation

the-mikedavis
Copy link
Collaborator

Looks like this function used to be a macro in elixir < 1.10...
michael@mango ~> nix-shell -p elixir_1_9
these paths will be fetched (3.29 MiB download, 5.37 MiB unpacked):
  /nix/store/ds8swb2gz7wmlncwm3bx8aj7mxrxkngi-elixir-1.9.4
copying path '/nix/store/ds8swb2gz7wmlncwm3bx8aj7mxrxkngi-elixir-1.9.4' from 'https://cache.nixos.org'...

[nix-shell:~]$ iex
Erlang/OTP 23 [erts-11.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.9.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Bitwise.__info__(:functions)
[]
iex(2)> Bitwise.__info__(:macros)   
[
  &&&: 2,
  <<<: 2,
  >>>: 2,
  ^^^: 2,
  __using__: 1,
  band: 2,
  bnot: 1,
  bor: 2,
  bsl: 2,
  bsr: 2,
  bxor: 2,
  |||: 2,
  ~~~: 1
]
iex(3)> 
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
       (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
^C
[nix-shell:~]$ exit
michael@mango ~> nix-shell -p elixir_1_10
these paths will be fetched (3.53 MiB download, 5.89 MiB unpacked):
  /nix/store/xgfbgv3lr9vp6jsqr34pk8bq2dviazsx-elixir-1.10.4
copying path '/nix/store/xgfbgv3lr9vp6jsqr34pk8bq2dviazsx-elixir-1.10.4' from 'https://cache.nixos.org'...

[nix-shell:~]$ iex
Erlang/OTP 23 [erts-11.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.10.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Bitwise.__info__(:functions)
[
  &&&: 2,
  <<<: 2,
  >>>: 2,
  ^^^: 2,
  band: 2,
  bnot: 1,
  bor: 2,
  bsl: 2,
  bsr: 2,
  bxor: 2,
  |||: 2,
  ~~~: 1
]
iex(2)> Bitwise.__info__(:macros)   
[__using__: 1]

Here's the commit that changed it from macros to functions: elixir-lang/elixir@1e4e05e#diff-032f258b047753a20ce7dbe83d825bbf440b74bae27967d6f06eda11d379680e

No need to die on this hill and declare only ~> 1.10 compatibility: might as well just call the erlang functions like the stdlib does

@the-mikedavis the-mikedavis requested a review from a team July 2, 2021 13:48
@the-mikedavis the-mikedavis self-assigned this Jul 2, 2021
@the-mikedavis the-mikedavis merged commit a321154 into main Jul 2, 2021
@the-mikedavis the-mikedavis deleted the erlang-bxor branch July 2, 2021 13:51
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

Successfully merging this pull request may close these issues.

1 participant