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

・1 min read

Four years ago I was so bored I made this:

<?php
$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!

DISCUSS (5)
 

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.

 

This talk at RubyConf 2017 has some of the most impressive, mind-boggling, examples of this that I've ever seen: confreaks.tv/videos/rubyconf2017-e...

 
Classic DEV Post from Mar 6

GraphQL performance issues & an easy solution

One of the biggest GraphQL flaws is missing of some basic implementations know from REST which are crucial for application performance.

a short bio.

A blogging community of over 100,000 software developers Join dev.to