What is this for the data type?

Hi all
Could please someone explain to me:

locale "en",
    flash: [
      hello: "Hello %{first} %{last}!",
      bye: "Bye, %{name}!"

Which datatype is flash? Keyword list?

1 Like

This one is a little bit hard to answer, since I do not know how exactly you mean “which datatype is flash?”. Therefore I will give you an answer to both ways that question can get interpreted, depending on knowledge.


The above expression is syntactic sugar for the snippet given below. One needs to be aware of that to be able to understand my answers.

locale("en", [
  {:flash, [
    {:hello, "Hello %{first} %{last}!"},
    {:bye, "Bye, %{name}"}
  1. The type of “flash” itself

As you can see in the desugared snippet, “flash” is for real :flash and as such an atom.

  1. The type of the data associated to :flash

We have a list of tuples with the first element beeing atoms and arbitrary second elements. This type of list is also known as a proplist (erlang) or keywordlist (elixir), maybe there are even other names for it around in other BEAM-languages.


I actually wrote my answer before your edit, but I’ll leave everything in.


Thanks so much…