使用行为

-behaviour 指令添加到模块以指示它遵循行为:

 placeholderCopy-behaviour(gen_server).

美国拼写也被接受:

 placeholderCopy-behavior(gen_server).

现在,如果你忘记实现并导出行为所需的任何功能,编译器将发出警告,例如:

-none langCopyfoo.erl:2: Warning: undefined callback function init/1 (behaviour 'gen_server')