Skip to content

[Challenge] Can you play with your language's syntax without breaking it?

zerquix18 profile image I'm Luis! \^-^/ twitter logo github logo ・1 min read

Four years ago I was so bored I made this:

$lol = "lol";
define("HAHA", $lol, 1);
class ha
    public function result()
        return 'This will be the result!';
class idk
    public function lol()
        return array(0, new ha() );
function lol()
    return array( new idk() );
echo ${HaHa}()[0]->{${$lol}}()[1]->result();

This still works on PHP 7.1! Can you do it with your favorite language?

NOTE: This is just for fun. Don't do this while actually coding!

twitter logo DISCUSS (5)
markdown guide

I've barely touched perl, but the program/poem "Black Perl" is infamous:

BEFOREHAND: close door, each window & exit; wait until time.
    open spellbook, study, read (scan, select, tell us);
write it, print the hex while each watches,
    reverse its length, write again;
    kill spiders, pop them, chop, split, kill them.
        unlink arms, shift, wait & listen (listening, wait),
sort the flock (then, warn the "goats" & kill the "sheep");
    kill them, dump qualms, shift moralities,
    values aside, each one;
        die sheep! die to reverse the system
        you accept (reject, respect);
next step,
    kill the next sacrifice, each sacrifice,
    wait, redo ritual until "all the spirits are pleased";
    do it ("as they say").
do it(*everyone***must***participate***in***forbidden**s*e*x*).
return last victim; package body;
    exit crypt (time, times & "half a time") & close it,
    select (quickly) & warn your next victim;
AFTERWORDS: tell nobody.
    wait, wait until time;
    wait until next year, next decade;
        sleep, sleep, die yourself,
        die at last

TDD sounds more alchemical or goetic but I suppose everybody's a syncretist nowadays.

Classic DEV Post from Aug 6 '19

What to put in your portfolio as a beginner web dev

I'm Luis! \^-^/ profile image
a short bio.