Erlang 函数的命名约定
Naming convention for Erlang functions
我试图创建一个类似于 5gc_ep_n2 的函数名称,但它给了我一个语法错误。 Erlang 中函数的确切命名约定是什么?
已更新:发现这个 reference 也有帮助。
函数名是原子,遵循与原子相同的规则。来自 the reference manual:
An atom is to be enclosed in single quotes (') if it does not begin with a lower-case letter or if it contains other characters than alphanumeric characters, underscore (_), or @.
所以你可以调用你的函数 5gc_ep_n2
,但你必须用单引号将它括起来,'5gc_ep_n2'
,无论是定义还是调用它。
我试图创建一个类似于 5gc_ep_n2 的函数名称,但它给了我一个语法错误。 Erlang 中函数的确切命名约定是什么?
已更新:发现这个 reference 也有帮助。
函数名是原子,遵循与原子相同的规则。来自 the reference manual:
An atom is to be enclosed in single quotes (') if it does not begin with a lower-case letter or if it contains other characters than alphanumeric characters, underscore (_), or @.
所以你可以调用你的函数 5gc_ep_n2
,但你必须用单引号将它括起来,'5gc_ep_n2'
,无论是定义还是调用它。