1

有什么方法可以让 Erlang 忘记内置函数,以便我可以使用该名称?

例如。忘记找回

4

1 回答 1

6

There's a bit of confusion here.

  1. retrieve is not a built-in function, you may be thinking of receive
  2. receive is not a built-in function, but a special token in the language, much like if, case, end, and so on. These cannot be modified.
  3. BIFs are mostly implemented in the erlang module, and you cannot redefine this one
  4. Many of the BIFs in erlang are auto-imported in modules and such. Any module-local definition will take over these, and otherwise they're syntactic shortcuts for erlang:MyBif(...).
  5. The shell replicates these auto-imports, but also provides additional functions. They are technically not BIFs. See Shell Commands
  6. You can override the auto-imports for the shell by configuring your own user_default module. These will only work in the shell.
  7. To avoid auto-imports in modules, use the -compile({no_auto_import,[Name/N]}). module attribute, so that Name(...) always uses the local function.
于 2015-08-08T16:14:28.710 回答