10

In the Star Trek franchise, a number of characters "reprogram a computer" or "write a holodeck program" or do similar sorts of programming. Has is ever been identified what sort of languages are in use in this universe?

  • 6
    They use Logo.. You know you can move that turtle in 3D space.. – I Love You 3000 Jan 15 '18 at 0:35
  • Why bother "writing" anything when you can just tell the computer to "install a recursive algorithm" instead? – Valuator Jan 15 '18 at 22:37
  • Klingon On Rails, lol, Well I saw some screens with pseudo C++ code – nodws Jan 16 '18 at 1:10
  • 2
    I'm not sure what they use on the ships, but at least half the legacy codebase of civilian infrastructure will be COBOL. – DonFusili Jan 18 '18 at 7:12
22

C++

No, seriously, they still use C++. Heck, they're even still doing their own memory management!

In Star Trek: Discovery 1x03 "Context is for Kings", Stamets asks Burnham to "reconcile these two pieces of code". When she later shows the location where the error is, it's clearly C++, or something remarkably similar to it.

Star Trek: Discovery uses C++ code

Here are the last few lines of the code:

LPVOID _stdcall VirtualAlloc(LPVOID ipAddress, SIZE_T dwSize, flAllocationType, DWORD flProtect);
HANDLE _stdcall CreateMutexW(LPSECURITY_ATTRIBUTES ipMutexAttributes, BOOL bInitialOwner; LPCWSTR ipName);
UINT _stcall SetErrorMode(UINT uMode);
BOOL _stdcall FreeLibrary(HMODULE hLibModule);

VirtualAlloc, CreateMutex (but not CreateMutexW), SetErrorMode, and FreeLibrary are all part of C++ recognized by Microsoft Windows in our time.

And yeah, you could probably argue that this C++ is placeholder for just "really complex-looking code", but given that Burnham debugging this specific piece of code is a plot point in the episode, I'm going to count it.


Thanks to Jules in the comments for finding the source of this code!

.. interestingly, that code appears to be the real-world source code for the standard Windows system component, kernel32.dll. Or a very near replica of it. Possibly an automated reverse engineering of it, given the poor choice of variable names.

The function that's shown in full (rather than just as a header) is GetCurrentProcess -- the windows documentation for that shows that it is part of kernel32.dll. Wikipedia comments that kernel32.dll mostly just delegates functionality to ntdll.dll, which you can see is exactly what the code shown is doing: it loads a reference to ntdll.dll, finds a pointer to a function from it, then calls it.

So apparently, they're still using Microsoft Windows in the 23rd Century and bugs are preventing Starfleet's science division from getting any work done! So much for Gene Roddenbery's dream of a utopic future!

  • 12
    It's C+++ in the 22nd century... – Machavity Jan 15 '18 at 0:10
  • 1
    @Bat I meant the Star Trek franchise, not a particular show. Plus, Episode 6 shows that Discovery pretty much has their own holodeck #DiscoveryBreaksContinuity – Thunderforge Jan 15 '18 at 0:40
  • 1
    @HamSandwich Wikipedia says it's canon. I think the explanation that the showrunners gave is that Klingons have all sorts of appearances and that this is just a subgroup of Klingons we haven't seen before. Whether you are satisfied with that or not is up to you, but it's just as canon as every other TV show is. – Thunderforge Jan 15 '18 at 1:37
  • 1
    The difference is that the code shown is 99% commented out, but Trek AI computers are able to read the comments and just do what the programmer really wanted. – The Photon Jan 15 '18 at 19:35
  • 2
    @Thunderforge - the function that's shown in full (rather than just as a header) is GetCurrentProcess -- the windows documentation for that shows that it is part of kernel32.dll. Wikipedia comments that kernel32.dll mostly just delegates functionality to ntdll.dll, which you can see is exactly what the code shown is doing: it loads a reference to ntdll.dll, finds a pointer to a function from it, then calls it. – Jules Jan 15 '18 at 22:09
7

In Discovery Season 2, Episode 8 (If Memory Serves), they talk about

"...multiple SQL Injections".

It's 2250 and people still don't clean user input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.