r/programminghorror • • Mar 25 '26

c System.out.print()

Post image
915 Upvotes

58 comments sorted by

View all comments

Show parent comment

7

u/EV-CPO Mar 25 '26 edited Mar 25 '26

That's a poor AI attempt at a polyglot. It's not. It's a bash script that uses separate bash, perl, and python commands to execute different code snippets. It answered the question: "write a 'hello world' program in three different languages" which is not a polyglot.

Here's a real polyglot that actually runs in bash and Python.

#!/bin/bash

"true" '''

echo "Hello from Bash"

exit

'''

print("Hello from Python")

see: https://en.wikipedia.org/wiki/Polyglot_(computing)

3

u/HashDefTrueFalse Mar 25 '26

Yeah, if I'd taken even a second to look I'd have seen. As I said, copy/pasted from Google. Shouldn't have bothered. Not like I was going to write one myself for a quick post though. I'll remove it.