haxe中的代码替换宏?
Code replacement macro in haxe?
如何将所有出现的 fun
替换为 function
,而不明显地将 function
之类的东西变成 functionction
。
在使用 fun
时,我将如何消除对 return
的需求?
我不认为你可以用宏引入新的关键字,你必须使用某种有效的语法,你可以将其转换为其他有效的语法。
A basic macro is a syntax-transformation. It receives zero or more expressions and also returns an expression. If a macro is called, it effectively inserts code at the place it was called from. In that respect, it could be compared to a preprocessor like #define in C++, but a Haxe macro is not a textual replacement tool.
Source: macro in the Haxe manual
如何将所有出现的 fun
替换为 function
,而不明显地将 function
之类的东西变成 functionction
。
在使用 fun
时,我将如何消除对 return
的需求?
我不认为你可以用宏引入新的关键字,你必须使用某种有效的语法,你可以将其转换为其他有效的语法。
A basic macro is a syntax-transformation. It receives zero or more expressions and also returns an expression. If a macro is called, it effectively inserts code at the place it was called from. In that respect, it could be compared to a preprocessor like #define in C++, but a Haxe macro is not a textual replacement tool.
Source: macro in the Haxe manual