Delphi 7 类助手的先见之明
今天,我碰巧使用 Delphi 7 编译了一段具有这样的类定义的代码
type TAudioStream = class helper of TStream;
,令我惊讶的是,编译器吐出
“系统单元已过期或损坏:缺少 'TClassHelperBase'”。
看起来Delphi7 已经保留了一些helper
词的用法。
Delphi 在 Delphi 8 中引入了 Helper 类。它们旨在将 VCL 绑定到 .Net。那么,Delphi7有先见之明吗?
Today I happened to compile, using Delphi 7, a code with a class definition like this
type TAudioStream = class helper of TStream;
and, to my astonishment, the compiler spits
"System unit out of date or corrupted: missing 'TClassHelperBase'".
It looks like Delphi7 has already some reserved usage of the helper
word.
Delphi introduced Helper classes in Delphi 8. They were intended for binding VCL to .Net. So, is Delphi7 prescient?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不确定这是否是一个真正的问题。保留关键字以供将来实施是一种常见的做法。 Delphi 8 的路线图和计划的功能应该在 Delphi 7 的发布日期指定。所以,是的,我认为 Delphi 7 在这种情况下是有先见之明的。
I'm not sure if this a real question. Reservation of keywords for future implementation is a common practice. The roadmap and the planned features for Delphi 8 should be specified at the release date of Delphi 7. So yes, I think Delphi 7 is prescient in this case.
请记住,Delphi 7 包含“.Net 预览编译器”。 Delphi 7 知道一些即将推出的功能,显然,它甚至在某种程度上知道这些功能的实现 - 它知道足够的信息来期望某些东西出现在系统单元中,并在它们不存在时进行抱怨。
Remember that Delphi 7 included the ".Net preview compiler." Delphi 7 was aware of some upcoming features, and evidently, it was even somewhat aware of the implementation of those features — it knew enough to expect certain things to be in the System unit and to complain when they weren't present.
对于语言设计者来说,保留某些单词以供将来使用是很常见的。例如,
class
和interface
已经在 JavaScript 中被保留了……十年了……尽管预计它们在接下来的几年内不会被使用。goto
是 Java 中的保留字,尽管永远预计不会使用它。编译器编写者实现功能以供将来使用也是很常见的。例如,泛型已经在 Sun 的 Java 1.2 javac 编译器中实现,尽管它们直到 Java 5 才添加到语言规范中。
It is quite common for language designers to reserve certain words for future use.
class
andinterface
, for example, have been reserved words in JavaScript for … what, ten years now … even though they aren't expected to be used for another couple of years.goto
is a reserved word in Java, even though it is never expected to be used.It is also quite common for compiler writers to implement features for future use. Generics, for example, were already implemented in Sun's Java 1.2
javac
compiler, even though they weren't added to the language specification until Java 5.