请考虑以下示例。
iex(2)> defmodule User do
...(2)> defstruct name: "tester"
...(2)> end
{:module, User,
<<70, 79, 82, 49, 0, 0, 8, 32, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 232,
0, 0, 0, 22, 11, 69, 108, 105, 120, 105, 114, 46, 85, 115, 101, 114, 8, 95,
95, 105, 110, 102, 111, 95, 95, 9, 102, ...>>, %User{name: "oste"}}
iex(4)> test = User
User
iex(5)> %test{}
** (CompileError) iex:5: expected struct name to be a compile time atom or alias, got: test
iex(5)> %User{}
%User{name: "tester"}
我从配置中获取了结构,我想根据指定的配置创建新的结构。