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

Support Erlang 21 new features #6611

Closed
9 tasks done
josevalim opened this issue Sep 28, 2017 · 23 comments
Closed
9 tasks done

Support Erlang 21 new features #6611

josevalim opened this issue Sep 28, 2017 · 23 comments

Comments

@josevalim
Copy link
Member

josevalim commented Sep 28, 2017

To be implemented when Erlang 21 is released (part of v1.7):

  • Support new handle_continue/2 gen_server callback
  • Support the __STACKTRACE__ variable in catch and rescue and Erlang's new try/catch clauses
  • Deprecate System.stacktrace outside of catch and rescue
  • Integrate with the new logger API (done on v1.6.6)

To be implemented when we require Erlang 21 exclusively:

  • Unify :logger and Logger metadata (done in Use Erlang's logger as main logging implementation #9333)
  • Remove assert_no_null_byte from file operations and get_env/put_env (find_executable and cmd still need it)
  • Optimize elixir_erl_try.erl by removing old stacktrace logic and unifying all clauses into a single one with map_get
  • Add is_struct/1 and is_struct/2
  • Add is_map_key/2
@OvermindDL1
Copy link
Contributor

Use the new compile_info compiler option to attach Elixir compiler metadata

No way of doing that when building on OTP21 as it stands before it is required?

@josevalim
Copy link
Member Author

We need to check the version because otherwise the data ends up in compile_info but in the wrong place (under options).

@michalmuskala
Copy link
Member

I wonder about support for map.field in guards - this requires introducing the map_get guard to Elixir. In the past we haven't introduced new guard functions until all supported versions had them (see ceil/1 and floor/1 we still don't support because we support OTP 19).

@gerhard
Copy link

gerhard commented May 3, 2018

Could this error be related? rabbitmq/rabbitmq-server-boshrelease@0d23f39

We're hitting it on OTP 21.0-rc1 with RabbitMQ 3.7.4 which is using Elixir 1.6.0

cc @hairyhum @michaelklishin @dumbbell

@michalmuskala
Copy link
Member

Yes. Elixir does not support OTP 21 yet, some failures are expected.

@michalmuskala
Copy link
Member

michalmuskala commented May 13, 2018

An additional thing is map iterators - many functions in the erlang's maps module accept either a map or a map iterator. Should we extend our Map module in the same way?

@josevalim
Copy link
Member Author

@michalmuskala that's a good point. I think we can wait for some usage patterns to emerge before actually adding it to the language.

@josevalim
Copy link
Member Author

@Jancd
Copy link

Jancd commented Jul 15, 2018

When I try to run Elixir from source,an error occured after running make test:

{"init terminating in do_boot",{'cannot get bootfile','no_dot_erlang.boot'}}
init terminating in do_boot ({cannot get bootfile,no_dot_erlang.boot})

Crash dump is being written to: erl_crash.dump...done
make: *** [lib/elixir/src/elixir_parser.erl] Error 1

Erlang/OTP version:Erlang/OTP 21 [erts-10.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe],and OS :CentOS7.

@josevalim
Copy link
Member Author

@7ethan how have you installed Erlang? Also see this issue: #7794 (comment)

@Jancd
Copy link

Jancd commented Jul 15, 2018

oh,got it.

@ekremkaraca
Copy link

Hey guys,

Since Erlang 22.0 was released, how about closing this issue and moving tasks to #8414?

@josevalim
Copy link
Member Author

josevalim commented May 17, 2019

@ekremkaraca we still support Erlang/OTP 20, so while we support it, we can't work on the pending tasks here. We will drop Erlang/OTP 20 once Elixir v1.10 is out (January 2020), then this issue can be addressed.

@wojtekmach
Copy link
Member

With map_get and is_map_key there could be a MapSet.is_member guard:

  defguard is_member(map_set, value)
           when :erlang.is_map_key(value, :erlang.map_get(:map, map_set))

Curious if there's any interest in that and/or a better implementation.

@ericmj
Copy link
Member

ericmj commented Jun 16, 2019

Should it also check :erlang.map_get(:__struct__, map_set) == MapSet?

There's a possibility dialyzer will complain about this guard because we are accessing internal fields of an opaque type.

@wojtekmach
Copy link
Member

Good point about checking __struct__. I checked with dialyxir and didn't see a warning.

@legoscia
Copy link

legoscia commented Oct 2, 2019

Would the Enumerable implementation for Map use iterators to implement reduce instead of :maps.to_list once depending on Erlang 21?

@michalmuskala
Copy link
Member

I did a test some time ago and unfortunately using iterators made a big performance difference - about 15%. The primary reason is that iterators are prepared for the erlang-style /2 functions, while we have /1 taking a 2-tuple, so using iterators means unpacking and repacking tuples all the time.

@josevalim
Copy link
Member Author

This is ready to be tackled.

hauleth added a commit to hauleth/elixir that referenced this issue Nov 3, 2019
@eksperimental
Copy link
Contributor

"Add is_struct/1" can be ticked off, and "and is_struct/2" crossed out.

@eksperimental
Copy link
Contributor

I would like to work on is_map_key/2. Is anybody already working on it?

@josevalim
Copy link
Member Author

josevalim commented Nov 3, 2019 via email

@hauleth
Copy link
Contributor

hauleth commented Nov 4, 2019

Closed 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests