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
josevalim opened this issue Sep 28, 2017 · 23 comments
Closed

Support Erlang 21 new features #6611

josevalim opened this issue Sep 28, 2017 · 23 comments

Comments

@josevalim
Copy link
Member

@josevalim 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 #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

This comment has been minimized.

Copy link
Contributor

@OvermindDL1 OvermindDL1 commented Sep 28, 2017

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

This comment has been minimized.

Copy link
Member Author

@josevalim josevalim commented Sep 28, 2017

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

@michalmuskala

This comment has been minimized.

Copy link
Member

@michalmuskala michalmuskala commented May 2, 2018

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

This comment has been minimized.

Copy link

@gerhard 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

This comment has been minimized.

Copy link
Member

@michalmuskala michalmuskala commented May 3, 2018

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

@michalmuskala

This comment has been minimized.

Copy link
Member

@michalmuskala 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

This comment has been minimized.

Copy link
Member Author

@josevalim josevalim commented May 13, 2018

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

@michaelklishin michaelklishin mentioned this issue May 30, 2018
45 of 45 tasks complete
@josevalim

This comment has been minimized.

Copy link
Member Author

@josevalim josevalim commented Jun 25, 2018

@Jancd

This comment has been minimized.

Copy link

@Jancd 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

This comment has been minimized.

Copy link
Member Author

@josevalim josevalim commented Jul 15, 2018

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

@Jancd

This comment has been minimized.

Copy link

@Jancd Jancd commented Jul 15, 2018

oh,got it.

@ekremkaraca

This comment has been minimized.

Copy link

@ekremkaraca ekremkaraca commented May 17, 2019

Hey guys,

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

@josevalim

This comment has been minimized.

Copy link
Member Author

@josevalim 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

This comment has been minimized.

Copy link
Member

@wojtekmach wojtekmach commented Jun 15, 2019

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

This comment has been minimized.

Copy link
Member

@ericmj 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

This comment has been minimized.

Copy link
Member

@wojtekmach wojtekmach commented Jun 16, 2019

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

@legoscia

This comment has been minimized.

Copy link

@legoscia 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

This comment has been minimized.

Copy link
Member

@michalmuskala michalmuskala commented Oct 2, 2019

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

This comment has been minimized.

Copy link
Member Author

@josevalim josevalim commented Nov 1, 2019

This is ready to be tackled.

hauleth added a commit to hauleth/elixir that referenced this issue Nov 2, 2019
hauleth added a commit to hauleth/elixir that referenced this issue Nov 2, 2019
hauleth added a commit to hauleth/elixir that referenced this issue Nov 3, 2019
Rel elixir-lang#6611

Co-Authored-By: Eksperimental <eksperimental@users.noreply.github.com>
hauleth added a commit to hauleth/elixir that referenced this issue Nov 3, 2019
Rel elixir-lang#6611

Co-Authored-By: Eksperimental <eksperimental@users.noreply.github.com>
hauleth added a commit to hauleth/elixir that referenced this issue Nov 3, 2019
Rel elixir-lang#6611

Co-Authored-By: Eksperimental <eksperimental@users.noreply.github.com>
@eksperimental

This comment has been minimized.

Copy link
Contributor

@eksperimental eksperimental commented Nov 3, 2019

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

@eksperimental

This comment has been minimized.

Copy link
Contributor

@eksperimental eksperimental commented Nov 3, 2019

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

@josevalim

This comment has been minimized.

Copy link
Member Author

@josevalim josevalim commented Nov 3, 2019

@josevalim josevalim closed this Nov 4, 2019
@hauleth

This comment has been minimized.

Copy link
Contributor

@hauleth hauleth commented Nov 4, 2019

Closed 🎉

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

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.