14

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?

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

2 Answers 2

27

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!

18
  • 13
    It's C+++ in the 22nd century...
    – Machavity
    Commented Jan 15, 2018 at 0:10
  • 3
    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
    Commented Jan 15, 2018 at 19:35
  • 5
    @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
    Commented Jan 15, 2018 at 22:09
  • 3
    Ouch, so not only do they still run C++, it's still on a MS OS... Trek is actually a dystopia. Who knew?
    – WeRelic
    Commented Jan 15, 2018 at 23:43
  • 4
    @JorgeCórdoba Yup. I look forward to the episode where Discovery gets a blue screen of death because Windows has 300 years of legacy code, so they decide to switch to simpler tech (explaining why the Enterprise computers ten years later are so "retro"). Commented Jan 18, 2018 at 23:47
12

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.

1
  • Cleaning input is the wrong way to solve SQL injection, anyway. It was 2019 and people still commented that user input should be cleaned! Commented Aug 25, 2022 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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