在Delphi 2009中使用泛型和匿名方法有什么问题?

发布于 2024-09-12 20:30:38 字数 245 浏览 5 评论 0原文

我想开始使用泛型和匿名方法,主要是为了了解它们的含义以及为什么我想使用它们。

使用 Delphi 2009 时,我经常读到泛型和匿名方法没有完全实现或有错误,这在 Delphi 2010 中得到了修复。

我希望避免每次出现问题时都不得不怀疑这是我的错还是 Delphi 2009 中的错误没有按我的预期工作。

我的问题是:
在 Delphi 2009 中使用泛型和匿名方法时到底会遇到哪些问题?
我应该避免什么?

I'd like to start using generics and anonymous method, mainly to learn what that's all about and why I would want to use them.

Having Delphi 2009, I often read that generics and anonymous methods are not completely implemented or buggy, which was fixed in Delphi 2010.

I would like to avoid having to wonder if it's my fault or a bug in Delphi 2009, every time something doesn't work as I expect.

My question is:
What exactly are the problems I will have when using generics and anonymous methods in Delphi 2009?
What should I avoid?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别在捏我脸啦 2024-09-19 20:30:38

你会遇到什么问题?好吧,如果一切都编译通过,那么通常就没问题。这不是一个糟糕的代码生成问题,更多的是一个没有代码生成问题。从通用模板创建实际代码往往会导致编译器陷入黑暗的角落,并且会出现内部错误。

你应该避免什么?冒着听起来尖酸刻薄的风险,您应该避免尝试在 D2009 中使用泛型并期望它们能够工作。 Update 3 修复了很多问题,但不是全部。 Delphi 2010 修复了更多问题,并且泛型现在基本上可以使用,除非您尝试将泛型与包混合使用。他们仍在努力完善该部分。此时,我建议再等待几周(大概),直到下一个版本发布并升级。如果幸运的话,他们将拥有与系统其他部分一样稳定工作的泛型。

What problems will you have? Well, if everything compiles, then you're usually fine. It's not a bad codegen issue, more of a no codegen issue. It's that creating actual code from the generic templates tends to lead the compiler into dark corners and you get internal errors.

What should you avoid? At the risk of sounding snarky, what you should avoid is trying to use generics in D2009 and expecting them to work. Update 3 fixed a lot of things, but not everything. Delphi 2010 fixed a lot more, and generics are mostly usable now, unless you're trying to mix generics with packages. They're still working on getting that part right. At this point, I'd recommend just waiting a few more weeks (presumably) until the next version comes out and upgrade. With any luck they'll have generics working as solidly as the rest of the system.

忆悲凉 2024-09-19 20:30:38

您可以使用质量中心。它可以让您 搜索特定标准(如版本)和关键字,以向您显示已报告的任何问题及其状态。请记住,某些已关闭的项目可能已在以后的版本中得到修复。

You can use Quality Central. It lets you search on specific criteria (like version) and keywords to show you any problems that have been reported and their status. Remember that some of the closed items might have been fixed in a later release.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文