如何覆盖 .长生不老药中的运算符?
How does one override the . operator in elixir?
我正在尝试覆盖 elixir 中的 .
(点)运算符。我能够覆盖其他二元运算符(例如 defmacro a + b do
可以很好地覆盖 +
),但是当我尝试使用 defmacro a . b do
覆盖 .
时,我得到以下信息错误:
defmacro a.b()
中的语法无效
有人知道覆盖 .
的正确语法吗?我试图找到点访问地图的实现代码,但我没有成功。
.
(点)运算符是 special form。
来自docs:
Special forms are the basic building blocks of Elixir, and therefore
cannot be overridden by the developer.
我正在尝试覆盖 elixir 中的 .
(点)运算符。我能够覆盖其他二元运算符(例如 defmacro a + b do
可以很好地覆盖 +
),但是当我尝试使用 defmacro a . b do
覆盖 .
时,我得到以下信息错误:
defmacro a.b()
有人知道覆盖 .
的正确语法吗?我试图找到点访问地图的实现代码,但我没有成功。
.
(点)运算符是 special form。
来自docs:
Special forms are the basic building blocks of Elixir, and therefore cannot be overridden by the developer.