TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Ruby program that generates itself through a 128-language quine loop

350 pointsby sirnicolazover 2 years ago

25 comments

whageover 2 years ago
Ken Thompson wrote in his famous paper [1] about quines:<p>&gt; If you have never done this, I urge you to try it on your own. The discovery of how to do it is a revelation that far surpasses any benefit obtained by being told how to do it<p>Every once in a while I give them a try but I couldn&#x27;t yet create one and it frustrates me very much. Afraid of being denied that &quot;revelation&quot; I never dared to read his paper past that point. I&#x27;m afraid I might never read it because of my ego.<p>1: <a href="https:&#x2F;&#x2F;www.cs.cmu.edu&#x2F;~rdriley&#x2F;487&#x2F;papers&#x2F;Thompson_1984_ReflectionsonTrustingTrust.pdf" rel="nofollow">https:&#x2F;&#x2F;www.cs.cmu.edu&#x2F;~rdriley&#x2F;487&#x2F;papers&#x2F;Thompson_1984_Ref...</a>
评论 #33108233 未加载
评论 #33108954 未加载
_k9eqover 2 years ago
This was written by Yusuke Endoh, who also wrote this submission to the IOCCC that I remember being arguably more astonished when I saw it for the first time: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=QMYfkOtYYlg" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=QMYfkOtYYlg</a> (ASCII fluid dynamics).
评论 #33110754 未加载
faitswulffover 2 years ago
This issue imploring Yusuke Endoh to write a paper about it is amusing:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;mame&#x2F;quine-relay&#x2F;issues&#x2F;10" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mame&#x2F;quine-relay&#x2F;issues&#x2F;10</a><p>&gt; p-e-w:<p>&gt; This is more than a cool program – it&#x27;s a computer science breakthrough! Apparently, you have discovered a method for constructing quines based on an arbitrary blueprint involving any amount of languages. &gt; &gt; Please write a technical paper describing your approach. I&#x27;m sure you&#x27;ll have no trouble finding a CS journal that will publish it.<p>&gt; mame:<p>&gt; Okay I&#x27;ll submit to the Journal of Universal Rejection.<p>Later:<p>&gt; mame:<p>&gt; I&#x27;ll soon publish a book, &quot;The world of obfuscated, esoteric, artistic programming&quot;. The book explains how to write a uroboros quine. Hence, I proudly close this issue.<p>&gt; It also contains my almost all (about forty) works, including alphabet-only Ruby program, radiation-hardened quine, etc., and explains many techniques to write such programs.<p>&gt; You can buy my book on amazon.co.jp. Unfortunately, it is written in Japanese, yet another esoteric language. I hope anyone can translate to English.
评论 #33111275 未加载
trompover 2 years ago
Some background: <a href="https:&#x2F;&#x2F;esoteric.codes&#x2F;blog&#x2F;the-128-language-quine-relay" rel="nofollow">https:&#x2F;&#x2F;esoteric.codes&#x2F;blog&#x2F;the-128-language-quine-relay</a><p>Note that the author made the challenge even harder by sorting the languages in alphabetical order:<p>&gt; According to Endoh, the most challenging transitions were Befunge to BLC8 to brainfuck, as all three are esoteric. It runs through languages strictly in alphabetical order, so there was no opportunity to group easier-to-work-with languages together.
bheadmasterover 2 years ago
I am amazed. I have no idea how the hell could the author even do that.<p>Apparently, they have a book called &quot;The world of obfuscated, esoteric, artistic programming&quot;, but it seems to be written in Japanese. I hope it will be translated to English someday, so I may learn this dark sorcery.
评论 #33107939 未加载
drcabanaover 2 years ago
Last December I had the itch to do some blogging. As it happens, I wrote a four part series that explains in detail how to write quines and quine relays. The initial post can be found at <a href="https:&#x2F;&#x2F;drcabana.org&#x2F;quine&#x2F;" rel="nofollow">https:&#x2F;&#x2F;drcabana.org&#x2F;quine&#x2F;</a><p>I am a longtime lurker and finally decided to join in order to comment on this thread. I hope that it is not inappropriate to post a link to my own take on this material. If it is, please accept my apologies and feel free to downvote&#x2F;flag me out of existence.
评论 #33110452 未加载
belterover 2 years ago
I like the Radiation-hardened Quine: <a href="https:&#x2F;&#x2F;github.com&#x2F;mame&#x2F;radiation-hardened-quine" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mame&#x2F;radiation-hardened-quine</a>
评论 #33107900 未加载
kubbover 2 years ago
Many programmers complain that they can&#x27;t complete a hello world example in one or more of the languages featured here because they&#x27;re too difficult.<p>This guy demonstrated enough understanding of 128 of them to make this work.<p>Is the difference in competence really so big between us?
评论 #33106680 未加载
评论 #33109213 未加载
评论 #33106537 未加载
Liquixover 2 years ago
A work of art :)<p>Previous discussion: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6048761" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6048761</a> (177 comments) (2013)
jmartin2683over 2 years ago
It’s amazing what people can do with stuff like this. Such a beautiful language (Ruby) made so ugly yet beautiful when viewed from a higher altitude.. there’s a metaphor there somewhere
sirabenover 2 years ago
There is an ongoing issue in Nixpkgs[0] to package this quine, more help would be appreciated!<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;issues&#x2F;131492" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;issues&#x2F;131492</a>
pushedxover 2 years ago
One of the languages is Piet. Now that’s insane.
bilekasover 2 years ago
This is insane.. I remember when it was only 50 and I was blown away.
enviclashover 2 years ago
Code that writes code that writes code... my limited experience combining AWK and GAMS gave me impressively powerful feelings about my limited code. This surely belongs to the next level, I&#x27;ll go for more!
dwheelerover 2 years ago
This article explains the basic idea:<p>David Bertoldi&#x27;s &quot;How to write your first Quine program&quot; <a href="https:&#x2F;&#x2F;towardsdatascience.com&#x2F;how-to-write-your-first-quine-program-947f2b7e4a6f" rel="nofollow">https:&#x2F;&#x2F;towardsdatascience.com&#x2F;how-to-write-your-first-quine...</a><p>However, that article is a basic introduction. This 128-language quine loop is beyond expert, bordering on magic.
benj111over 2 years ago
If it&#x27;s a 128 language loop is it fair to describe it as ruby?<p>The other 127 languages presumably have all the information so you should be able to start and end at any language?<p>I guess in its current implementation the ruby code is the code that ends the loop? But that is optional?
评论 #33127678 未加载
评论 #33118887 未加载
kirjavascriptover 2 years ago
I wrote a new page describing how to write quines recently[1], but the quine-relay is really above and beyond<p>1: <a href="https:&#x2F;&#x2F;github.com&#x2F;kirjavascript&#x2F;quine-howto" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kirjavascript&#x2F;quine-howto</a>
mmohtasimover 2 years ago
Is there any 2 or 3 language version of this? Like ruby to python to java to ruby?
评论 #33109200 未加载
raydiatianover 2 years ago
How exactly does this work? Does one language invoke another and another in a chain, or ruby at the top calling A, then B, then C..<p>And is that an Ouroboros snake, or something else
评论 #33106319 未加载
avg_devover 2 years ago
I never zoom out on GitHub, but this one time it was kind of neat.
sixothreeover 2 years ago
The real difficulty is getting 128 languages to compile.
RektBoyover 2 years ago
Of course author is from Japan, of course.
ramigbover 2 years ago
Now this is how you market a book. cool.
neilwilsonover 2 years ago
Disappointed there is no Eiffel
polycasterover 2 years ago
But does it run Doom?