py_quine_template = "s = {}; print(s.format(repr(s)))"
py_quine = py_quine_template.format(repr(py_quine_template))
js_quine_template = "s = {}; console.log(s.replace('{}', JSON.stringify(s)))"
js_quine = js_quine_template.format(repr(js_quine_template))
py_js_quine = py_quine_template.format(repr(js_quine_template))
???
So I checked how it's done in the Github repo[1], but the language snippets only seemed to be quoting and printing without any self-references like you'd expect in a quine...Then it hit me. You only need the quine machinery in one language. If I can make a Python script that has a string with its own source code, then the Javascript code will simply be `console.log(py_source)`, no manipulation necessary.
So here's my Python/Javascript uroboros quine:
s = "s = {}\npy_source = s.format(repr(s))\nprint('console.log('+repr(py_source)+')')"
py_source = s.format(repr(s))
print('console.log('+repr(py_source)+')')
If there were more languages, then it'd be `console.log("System.out.println({python_source})")`, etc. The problem then becomes escaping inner quotes, and escaping the escape characters themselves. I managed to sidestep the issue by using two types of quotes, and relying on Python's `repr` also giving valid JS strings, but if I had to add just one more language I'd need a lot more scaffolding.I still think the Quine Relay is a tour de force, but now for different reasons. It's not 128 quines in different languages, but an incredibly robust system for escaping strings in 128 wildly different languages.
[1] https://github.com/mame/quine-relay/blob/master/src/code-gen...
I'm getting a tension headache just thinking about it.
i would also watch a 128 hour livestream of him coding it because how do you even start
My impression is, that they are an artist who just happens to use a medium not normally (directly) used for art: Code.
I'm not the creator of that magnificent piece of programmatical art. But I can take a stab at this. As long as the languages are Turing complete it is possible.
Any Turing machine can simulate any other Turing machine so once you step up to that level the challenge is keeping your head through the maze of nuances between many of those languages. I think the logic behind it goes something like this, if a language is complete (eg in the Gödel sense) then you can have it produce things that are nonsense in its own language.
Anyways I would expect the bulk of the work to be making those incremental step of going from each language to the next. In terms of data shape, I am thinking a linked list. So the final step is to call them all in a nested fashion, bootstrapping each up onto the top of that stack as you go.
There's (at least) one language in quine-relay that's not that simple: Piet. It's a visual 2D language written as an image file.