EProgrammerNotFound exception in Delphi?

前端 未结 8 1882
耶瑟儿~
耶瑟儿~ 2020-12-12 21:41

In Delphi 2009, SysUtils.pas contains this in line 425:

EProgrammerNotFound = class(Exception);
  • Is this simply an easter egg or somet
相关标签:
8条回答
  • 2020-12-12 21:52

    It is a kind of self describing joke, you can try this code

    raise EProgrammerNotFound.Create('Jack is away');
    

    or

    raise ENotImplemented.Create('May be in future this will work');
    

    The above works in Delphi 10 Seattle.

    0 讨论(0)
  • 2020-12-12 21:58

    It's the runtime analog of the compiler's "Syntax error: Programer expected." ;>

    0 讨论(0)
  • 2020-12-12 22:01

    It is used in conjunction with the "fix-inline" technology which requires that the programmer has to be linked into the exe file ;-)

    0 讨论(0)
  • 2020-12-12 22:01

    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>

    0 讨论(0)
  • 2020-12-12 22:04

    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

    • is declared in the Win32 branch of the SysUtils unit, but not used anywhere in the RTL or VCL
    • is not present in Delphi Prism
    • was introduced in Delphi 2009, so not present in VCL.NET
    • has currently (version 3.5) nothing similar in the .NET framework (not sure why, these guys do have humour)

    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

    0 讨论(0)
  • 2020-12-12 22:08

    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!"

    0 讨论(0)
提交回复
热议问题