Nao000のぶろぐ

蝶を追っている少年になりたい

Elixirに Records というものがあるらしい.

elixirのectoのリポジトリのGitのコミットログを見ていたら defrecord とかいうのがあった。

リポジトリ: https://github.com/elixir-ecto/ecto

hexdocsでdefrecord見たらRecordsの説明がありました。

Records are simply tuples where the first element is an atom:https://hexdocs.pm/elixir/Record.html

最初の要素がatomのタプルがRecordsだそうです。続いて以下の説明がありました。

In Elixir, records are used mostly in two situations:

  1. to work with short, internal data
  2. to interface with Erlang recordshttps://hexdocs.pm/elixir/Record.html

Erlangにもrecordsがあるらしいく、Elixirではインターフェースとして使われるらしいです。良く分からない。

ちなみに以下のコミットでdefstructに変更していました。

コミットハッシュ: 9cecefa52179187ee9b579c28a611e434cd4a49e