Upgrade guide to Elixir master (upcoming v0.10.0)

318 views
Skip to first unread message

José Valim

unread,
Jul 8, 2013, 5:46:12 AM7/8/13
to elixir-l...@googlegroups.com
Hello everyone,

Elixir v0.10 is coming out soon, we have some improvements planned for pretty printing and we should be good to go. That said, I recommend everyone to give Elixir master a try. If you are on homebrew (Mac OS X), this is just a matter of:

    brew unlink elixir
    brew install elixir --HEAD

If you are not on homebrew, we have instructions for compiling from master in our getting started. Don't forget to fully recompile your projects and their dependencies once you move to master.

The CHANGELOG lists our new features and our release announcement will go into more details on a couple of those. For this e-mail, I will go over details about the backwards incompatible changes to make the upgrade process easier.

1. Calling `Module.register_attribute/3` no longer automatically changes it to persisted or accumulated

The first thing you should do when upgrading to master is to search your project for calls to "Module.register_attribute". In previous versions, calling:

Module.register_attribute __MODULE__, :some_attribute

Automatically changed the attribute to persist and accumulate. Now, those arguments need to be explicitly given:

Module.register_attribute __MODULE__, :some_attribute, persist: true, accumulate: true

The choice for making those explicit is because many people were accidentally making their attributes persisted when they just wanted to accumulate it.

2. First element of a record via `defrecordp` is now the `defrecordp` name and no longer the current atom

The second change you should do is to search your project for occurrences of defrecordp. Previously, defrecordp returned the module name as the first element of the tuple:

defmodule User do
  defrecordp :user, [:name, :age]

  def new do
    user()
  end
end

User.new #=> { User, nil, nil }

In master, it is no longer the case, the first element is the record name:

User.new #=> { :user, nil, nil }

This is closer to how both Erlang records and defrecord behaves.
If you want to keep the previous behaviour, you can simply pass the module name as argument:

defrecordp :user, User, [:name, :age]


3. The `Binary.Inspect` protocol has been renamed to `Inspect`

One of the main features in v0.10 is support for pretty printing. The semantics of the Inspect protocol changed as of now an implementation for Inspect must return an algebra document and we have changed the protocol name to honor those new semantics. Luckily, a regular string is an algebra document, so If you are in a worry, you will likely be able to simply rename your implementations of the protocol from Binary.Inspect to Inspect and call it a day. However, if you want to use the pretty printing conveniences, we recommend you to start with reading the docs for Inspect.

4. Tighter grammar rules

In previous releases Elixir was very flexible with omitting parenthesis. The downside of that is that your code have more ambiguity, here is an example:

[1, is_atom :foo, 3]

Will the code above return [1, true, 3] or fail to compile because there is no function called is_atom that receives two arguments? That said, we have tightened the grammar rules a bit and the code above (and similar) will now fail to compile. Adding explicit parenthesis fixes it:

[1, is_atom(:foo), 3]

5. Custom parsers no longer supported in URI

Previously the URI module supported custom parsers. This functionality has been removed in favor of simplicity, so if you were registering new schemas with custom ports, this should now be done via URI.default_port/2.

6. Enjoy!

Those are the braking changes for this release. There has been a couple of deprecations too, but you will get warning for those. Everything else should just work™.

José Valim
Skype: jv.ptec
Founder and Lead Developer

Dave Thomas

unread,
Jul 8, 2013, 3:40:11 PM7/8/13
to elixir-l...@googlegroups.com

Elixir v0.10 is coming out soon, we have some improvements planned for pretty printing and we should be good to go. That said, I recommend everyone to give Elixir master a try. If you are on homebrew (Mac OS X), this is just a matter of:

Will there be a 0.9.4 beforehand (us authors who are trying to keep up ask anxiously... :) ?


Dave

José Valim

unread,
Jul 8, 2013, 3:52:47 PM7/8/13
to elixir-l...@googlegroups.com
I don't think we will have a 0.9.4 before. There is literally one issue holding off 0.10.0 which is related to pretty printing and we should be good to go. :)



José Valim
Skype: jv.ptec
Founder and Lead Developer


--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dave Thomas

unread,
Jul 8, 2013, 3:58:57 PM7/8/13
to elixir-l...@googlegroups.com
I don't think we will have a 0.9.4 before. There is literally one issue holding off 0.10.0 which is related to pretty printing and we should be good to go. :)

Cool, thanks... 

 Are we still looking for Erlang maps at the end of the year, with 1.0 a few months after that? Is there any way Joe could help expedite that?


Dave

José Valim

unread,
Jul 8, 2013, 4:30:52 PM7/8/13
to elixir-l...@googlegroups.com
Cool, thanks... 

 Are we still looking for Erlang maps at the end of the year, with 1.0 a few months after that? Is there any way Joe could help expedite that?

Yes, that's still the roadmap. The OTP team has planned a beta version of maps for this trimester, which gives us plenty of time for getting ready for Erlang R17A at the end of the year.

Reply all
Reply to author
Forward
0 new messages