开发者

Delphi 7 prescience of class helpers

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?


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.


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.


It is quite common for language designers to reserve certain words for future use. class and interface, 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜