如何在 Free Pascal 中使用匿名方法?
我尝试使用 Delphi 的匿名方法语法:
type
fun = reference to function(): Integer;
Fpc 显示语法错误:
Error: Identifier not found "reference"
What's the Free Pascal相当于 Delphi 的匿名方法(如果有)?
I tried to use Delphi's syntax for anonymous methods:
type
fun = reference to function(): Integer;
Fpc shows a syntax error:
Error: Identifier not found "reference"
What's the Free Pascal equivalent to Delphi's anonymous methods, if any?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
FreePascal 中未实现匿名方法。此类功能的列表位于此处。
Anonymous methods are not implemented in FreePascal. The list of such features is here.
支持匿名方法。有用的参考:
GitLab 问题:
https://gitlab.com/freepascal.org/fpc/source/ -/issues/24481
论坛公告:
https://forum.lazarus.freepascal.org/index.php?topic= 59468.0
最后,Sven在公告中给出的一些例子:
Anonymous methods are supported. Useful references:
The GitLab issue:
https://gitlab.com/freepascal.org/fpc/source/-/issues/24481
The forum annoucement:
https://forum.lazarus.freepascal.org/index.php?topic=59468.0
Finally, some examples given by Sven in the annoucement: