Slashdot Mirror


Quadrilingual Crazy Programming

mtve writes: "Have you ever seen source code that is valid on four languages: Perl, C, Befunge, and BrainF*ck? During last Perlgolf season famous Perl hacker Jérôme Quelin submit such inconceivable masterpiece and now he published expanded explanation of his solution. Caution: that text can hurt your mental health. Play Perlgolf!"

3 of 194 comments (clear)

  1. If your brain is fucked, code in 4 languages? by kiwipeso · · Score: 0, Troll

    What sort of lunatic wants code that compiles in 4 languages, anyway?
    Isn't it bad enough that microsoft creates gigabytes of code bloat, let alone all the geeks who are now going to try multi-lingual code?

    --
    - Kaos games and encryption systems developer
  2. i know it's silly... by tps12 · · Score: 0, Troll
    Okay, obviously this is just a joke. Those are all toy languages that haven't been used in production level applications.

    But think about what this means for more serious programming.

    Imagine a program that runs in C++, MySQL, and Apache. This could be a new era in cross-platform development!

    Programmers: please study this closely, and we will finally allow Linux to compete.

    --

    Karma: Good (despite my invention of the Karma: sig)
  3. where's my O'Reilly book? by WebMasterJoe · · Score: 2, Troll

    I don't know if there's an official term for it, but I often write a function in one language that writes code for another language - for example, using PHP or Perl to write javascript. I've even gone so far as to use PHP to write a SQL statement which in turn is used to determine what will go in a Javascript function that writes HTML code. The example below is rather pointless, but I have come across real situations where it is beneficial to use that many languages together.

    function hello() {
    $q = "select * from helloworld where id=1;";
    $connect = pg_pconnect("dbname=hw user=webber password=dipsh*t");
    $cursor = pg_exec($connect, $query);
    $r = pg_fetch_row($cur,0);
    echo "<script>\n";
    echo "function do_it() {\n\tdocument.write(\"".$r[0]."\");\n}\n";
    echo "</script>";
    }

    That's three "real" languages and one markup language. And if you think that was crazy, think about this - I just had to write that in HTML in a slashdot posting textbox!

    My next goal is to make the javascript write out HTML for parameters in a Java applet. And, the whole PHP page is going to be written by a C program exectuted by a cron job that was set up via a perl script (webmin!) That's eight different languages - perl -> bash (I think) -> C -> PHP -> SQL and Javascript -> HTML -> Java. Sadly, I don't think that's nearly as crazy as the quadrilingual program. I need to learn Brainf*ck.

    --
    I really hate signatures, but go to my website.