Delphi 中的 EProgrammerNotFound 异常?
在 Delphi 2009 中,SysUtils.pas 在第 425 行包含此内容:
EProgrammerNotFound = class(Exception);
- 这只是一个 复活节彩蛋或者其他严肃的事情?
- 什么时候应该提出这个例外?
- 它也存在于 Delphi Prism 和/或 Free Pascal 中吗?
问:这个异常类还在Delphi(目前是XE7)中声明吗? 答:是的,甚至已记录!
指示软件故障的非标准方式。
您可以使用 EProgrammerNotFound 作为指示软件的替代方法 运行时检测到的错误。
In Delphi 2009, SysUtils.pas contains this in line 425:
EProgrammerNotFound = class(Exception);
- Is this simply an easter egg or something serious?
- When should this exception be raised?
- Does it also exist in Delphi Prism and/or Free Pascal?
Q: Is this exception class still declared in Delphi (currently XE7)?
A: Yes, and it is even documented!
Nonstandard way to indicate software faults.
You can use EProgrammerNotFound as an alternative to indicate software
faults detected at run time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
这只是漫长的一天的结果,我们有点头晕。多年来(自从我加入团队以来),我们总是开玩笑说用类似的消息替换编译器中最常见错误之一的某些错误消息。在内部,我们总是对不同的事物和人(主要是团队本身)开玩笑和取笑。如果你没有幽默感,你注定会早逝。
这是一次简单的谈话;
“哦,你应该在该函数中引发 EProgrammerNotFound 异常。”
“哈哈!我们应该添加这个例外,看看谁会注意到。”
“我想知道会有多少关于它为什么在那里的猜测?”
所以,我想我只能说,“你们都正中我们的下怀;-)...Buwahahaha!pwned!”
It is just the result of a long day and we had gotten a little giddy. For many, many years (ever since I'd been on the team), we'd always joked about replacing some error message in the compiler for one of the most common errors with a similar message. Internally we've always joked and poked fun at different things and people (mostly on the team itself). If you don't have a sense of humor, you're destined to an early grave.
It was a simple conversation;
"Oh, you should have raised the EProgrammerNotFound exception in that function."
"LOL! We should add that exception and see who notices."
"I wonder how much speculation there will be about why it is there?"
So, I guess all I can say is, "You've all played right into our hands ;-)... Buwahahaha! pwned!"
它与“fix-inline”技术结合使用,该技术要求程序员必须链接到exe文件中;-)
It is used in conjunction with the "fix-inline" technology which requires that the programmer has to be linked into the exe file ;-)
它是在 Delphi 2009 中引入的,在 Delphi 2010 中仍然存在,最近得到了一些更多 注意 互联网。
我认为这是一个复活节彩蛋,类似于“EBCAK”(椅子和键盘之间的错误),并且跳过 Delphi 版本号 13。
EProgrammerNotFound
我不认为 EProgrammerNotFound 实际上是本来就应该使用,但既然它在那里,人们就会开玩笑地使用它(类似于在别人的源代码中放置一个杂散的“const False = True; True = not False;”)。
——杰罗恩
It was introduced in Delphi 2009, still present in Delphi 2010, and recently got some more attention on the internet.
I think it is an easter egg, similar to "EBCAK" (Error Between Chair and Keyboard), and the skipping of Delphi version number 13.
EProgrammerNotFound
I don't think EProgrammerNotFound is actually meant to be used at all, but since it is there, people will jokingly use it (similar like putting a stray "const False = True; True = not False;" in someone elses sourcecode).
--jeroen
起源是有争议的,但它已经为人所知一段时间了......
Marco Cantu 在“德尔福的有趣一面”会议上开玩笑说。
IMO,应该更频繁地使用它;-)
继续阅读:
http://wings-of-wind.com/ 2010/01/12/史上最佳编程功能/
http://blog.barrkel.com/2008/11/reference -counted-pointers-revisited.html
PS:我认为它不存在于 Delphi Prism、FreePascal 或 C# 中(但它应该存在)。
The origin is debatable, but it's been known for a while...
Marco Cantu joked about it in a "Fun Side of Delphi" session.
IMO, it should be used more often ;-)
Read on:
http://wings-of-wind.com/2010/01/12/best-programming-feature-ever/
http://blog.barrkel.com/2008/11/reference-counted-pointers-revisited.html
PS: I don't think it exists in Delphi Prism, FreePascal or C# (but it should).
<G>
它是编译器“语法错误:程序员预期的错误”的运行时模拟。 ;>
It's the runtime analog of the compiler's "Syntax error: Programer expected." ;>
这是一种自我描述的笑话,你可以尝试这个代码
或者
上面的代码在 Delphi 10 Seattle 中有效。
It is a kind of self describing joke, you can try this code
or
The above works in Delphi 10 Seattle.
对于程序员来说,所引用的并不是坐在 Delphi 后面的程序员。我认为它的用途是在 D2009 及更高版本中他们计划(从未使用过它不知道它是否有效)每个对象都是可等待的。
With programmer, it is not the programmer that is sitting behind Delphi that is referenced. I think it is used for the fact that in D2009 and above they planned (never used it don't know if it works) that every object was waitable.
我是一名程序员,我是例外吗?
Marco Cantù 在他的书《Delphi 2009 手册》第 242 页中也描述了这一点。他表示 VCL 源代码中从未使用过这一点。
I am a programmer, am I an exception than ?
Marco Cantù also describes this in his book 'Delphi 2009 handbook' - page 242. He tells it's never jused in the VCL source code.