2016-08-10 6 views
2

레코드를 기반으로 ETS 테이블을 만들려고 할 때 문제가 발생했습니다. 이 코드는 책 Introducing Elixir에서 가져온 것입니다. 테이블이 다음과 같이 생성 된 경우ETS 테이블 생성 오류

defmodule Planemo do 
    require Record 
    Record.defrecord :planemo, [name: nil, gravity: 0, diameter: 0, distance_from_sun: 0] 
end 

지금, 그것은 성공 : 여기

레코드의 또 다른 예에서

planemo_table = :ets.new(:planemos,[:named_table, {:keypos, Planemo.planemo(:name) + 1}]) 

, 저자는 다음과 같은 구문 (__record__)를 사용하며 실패 :

planemo_table = :ets.new(:planemos,[:named_table, {:keypos, Planemo.__record__(:index, :name) + 1}]) 

오류 :

** (UndefinedFunctionError) function Planemo.__record__/2 is undefined or private 
    Planemo.__record__(:index, :name) 
    planemo_storage.ex:6: PlanemoStorage.setup/0 

나는 처음으로 __record__이 Elixir 1.3.2에서 더 이상 사용되지 않을 것이라고 생각했지만 그 어떤 흔적도 찾을 수 없었습니다. 도와주세요.

답변