Sign up ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

This question already has an answer here:

Make a program which prints just another #{LANG} hacker where #{LANG} is the name of the language with which the program is being run.

For example, if I run your program with Bash, I'd expect just another Bash hacker as the output, but when running the same program through C++, I'd expect the output to be just another C++ hacker.

Your program must run in and produce correct output in at least two different languages.

This is in no way a duplicate of the other suggested question, Write a polyglot that prints the language's name; that question asks for a rather short (and in my opinion) uninteresting output, increasing the easiness of writing and number of languages in an answer, and then it assesses them (these polyglots) based on the source's length!

A correct response to this question, however, would produce longer outputs, and thus would have actually been fairly challenging and fun to write and it would be more difficult to add languages to your polyglot. I then assess the polyglots in a natural way; by the number of languages they support!

I think that this will lead to very different answers being submitted on either question, but also different uses for these answers; the programs which will be submitted here are the type of programs which would be flaunted around the internet for their ingenuity and creativity, "look! Here's a guy who can pull off a swaggy polyglot in 4 different languages! They're cool!"

When I asked this question, I thought I'd put a twist on the popular and well known Just Another Perl Hacker competition, but add some creativity and an extra "Wow!" factor; JAPH programs are often sported as signatures in forums etc., and I believe entries here will inspire similar use, unlike entries for the other question.

Also, because this isn't a form of code-golf like the other question, but I'm actually assessing answers on the number of languages they support, I believe we can expect some rather incredible entries, making use of language features and loopholes we never knew existed!


  • Two different versions of the same language only count separately if:
    • You print out the version as well as the language name, for each version.
    • You detect which version is running thraough a less trivial method than running a ver() function or similar built-in of your language.
    • The two have different major version numbers.

For example, if you say your program runs in both Python 3.4.1 and 2.7.8, here are the necessary outputs:

Python 3.4.1

just another Python 3.4.1 hacker

Python 2.7.8

just another Python 2.7.8 hacker

If your program doesn't produce the above outputs for each version, then you cannot list the two separate versions as different languages under which your code runs.

  • You may not have any errors on the maximum level of warning in any of the languages.
  • Program must terminate.


  • Whoever's (valid) answer supports the most languages. In the case of a tie, the shorter answer (by program byte count) wins.
share|improve this question

marked as duplicate by Howard, Gareth, Johannes Kuhn, Justin, syb0rg Dec 31 '13 at 1:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Why the 'maximum level of warning'? That seems rather harsh. – marinus Dec 30 '13 at 21:10
I think this is sufficiently separate from those. – Timtech Dec 31 '13 at 0:04
1) Please don't write your question starting with what's it's almost like, then what to change to make it the question (or, in your case, initial idea, then edit), it's really a pain to read. 2) It's still the same challenge as the question marked as duplicate. – J B Dec 31 '13 at 21:11
Then there is this:… – Jerry Jeremiah Jun 1 at 23:30

6 Answers 6

C, C++, Perl, Bash – 230

#include <stdio.h>
#define c const char*\
s="just another %s hacker\n"
//bin/test;printf "$s" Bash;exit
int main(){c;printf(s,sizeof'a'-1?"C":"C++");}
/*==;seek DATA,0,0;@a=readline DATA;eval'$'.$a[2];printf $s,"Perl";

This was fun! :-)

230 chars including a newline at end of file. To run, save as both poly.c and poly.cpp and do:

$ gcc -Wall -Wextra -pedantic poly.c && ./a.out 
just another C hacker
$ g++ -Wall -Wextra -pedantic poly.cpp && ./a.out 
just another C++ hacker
$ perl poly.c
just another Perl hacker
$ bash poly.c
just another Bash hacker
share|improve this answer
This generates warnings when run with perl -w, and doesn't compile at all with -Mstrict. – Ilmari Karonen Dec 30 '13 at 22:04


#ifdef __cplusplus
#    include <iostream>
#    define LANG "C++"
#    define PRINT(text) { std::cout << text; }
#    include <stdio.h>
#    define LANG "C"
#    define PRINT(text) { printf("%s", text); }

int main(void) {
    PRINT("just another ");
    PRINT(" hacker\n");

    return 0;

Compiling and executing:

$ gcc -ansi -Wall -Wextra -pedantic -o prog-c prog.c
$ ./prog-c
just another C hacker
$ g++ -ansi -Wall -Wextra -pedantic -o prog-cpp prog.c
$ ./prog-cpp
just another C++ hacker
share|improve this answer

BASH + BrainF*ck + PHP, 269 characters

#><?="Just another PHP hacker\n";die();?><
echo Just another BASH hacker #++++++++++[>+++++++>++++++++++++>++++++++++>+++++++++++>+++>+<<<<<<-]>++++.>---.--.+.>>>++.<<---.>.+.<<.>+++++++.---.>+++.>.<<<<<++++[>--<-]>.++++.>>>>.<<+++.-------.++.>-------.<++.>+++++++.>>.

Running the program:

$ php 
#>Just another PHP hacker
$ ./
Just another BASH hacker
$ bf
Just another BF hacker

A bit of stretching the rules with that PHP one, but it seems to work. I can fix it if it doesn't count.

share|improve this answer
One could possibly argue this is invalid because the language name is Brainfuck and not BF. – nyuszika7h Dec 30 '13 at 22:28
@nyuszika7h It's commonly abbreviated that way. – Tyzoid Dec 30 '13 at 22:54
True, I don't want to be the one deciding this, but it wasn't specified so... – nyuszika7h Dec 31 '13 at 11:00
Why not just edit the brainfuck program? Then it will be valid and it won't take very much effort to append a longer program in that comment. – theonlygusti Jun 1 at 10:48

Windows Batch, TI-Basic, Golf-Basic 84, and Quomplex

::¤"just another Quomplex hacker"¤:"'*[]'"
echo just another Windows Batch hacker

How it works

Windows Batch was the easiest, because :: starts a comment. Fairly simple to implement.

TI-Basic doesn't support lowercase letters or backticks, causing it to skip the statements d"JUST ANOTHER GOLF-BASIC 84 HACKER":g1 (backticks removed), which Golf-Basic evaulates, Displaying the message and forwarding to Label 1, where it is promptly ended.

Quomplex was snuck in at the beginning because its complex syntax won't allow for much to be skipped. All it does is add "just another Quomplex hacker" to the output, and then for the mastery of the program...

The Mastery of the Programming Syntax


Pure genius. Quomplex ignores : and takes "' and '" as strings, leaving it to output the stack and perish in an infinite while loop ([]). Meanwhile, Golf-Basic and TI-Basic take the whole "'*[]'" as a string, because ' is a mathematical operator, not a string operator.

share|improve this answer

JavaScript, HTML, BF

    // > to fix previous comment delim
    alert('Just another JavaScript hacker')
// --> Just another HTML hacker

Relies on the fact that most JS implementations ignore <!--.

BF code shamelessly stolen from @Tyzoid, all credit to him :-)

Make sure your BF interpreter supports pointer wrapping.

share|improve this answer
Careful! The first < will make your BrainF*ck program crash! – Tyzoid Dec 31 '13 at 0:13
Yea, invalid... – Timtech Dec 31 '13 at 0:46
@Tyzoid Oops, didn't notice :-P fixed – Doorknob Dec 31 '13 at 1:34
@DoorknobofSnow It's still not fixed. The problem is that BF starts on element zero on the tape, and does not allow a < to move you to element -1. It crashes before it hits your fix. It's the same problem I'm having with my PHP solution. – Tyzoid Dec 31 '13 at 3:01
@Tyzoid I mentioned that - "Make sure your BF interpreter supports pointer wrapping." – Doorknob Dec 31 '13 at 9:44

Lua 5.3/5.2/5.1/5.0/4.0/3.2

You said as long as I don't use _VERSION it is fine

print("Just another Lua"..(string and(loadstring"return 0//0"and"5.3"or(_ENV and"5.2"or(string.gmatch and"5.1"or"5.0")))or tremove(next({[{"4.0","3.2"}]=1},nil))).." hacker")
share|improve this answer
I don't know about Lua, but they must also have different version numbers and major syntax differences. – Juan Sebastian Lozano Muñoz Dec 31 '13 at 1:49
Well the question did not state the majorness of the syntactical differences. After all, C/C++ entries are valid – mniip Dec 31 '13 at 1:52

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