
QuineDB – A quine that is also a key-value store - panic
https://github.com/gfredericks/quinedb
======
qwertyuiop924
This is one of those glorious "because I can" projects that I love to see on
HN. It shows that in a world full of big data, VC, and startups, where tech is
a big buisiness, we can still do something for the fun of it, without having a
reason, or trying to provide value. In short, it shows that the hacker spirit
isn't dead.

I wonder if we can create a sort of Y combinator for quines: A function called
YQ, that, when called with any function X as an argument will pass X a value
that, when printed, generates reproduces both X and YQ, and calls X with YQ. I
suppose the problem is that it would be hard to reproduce all of the values X
depends on. You could just hedge on this, but that's not really the Right
Thing.

Also, I think this is the Most Functional database: it rebuilds the entire
program every time state changes.

~~~
panic
It's also the Most Object-Oriented database: it combines the data and the
procedures to access that data into a single encapsulated object. An exemplary
design in all respects!

~~~
qwertyuiop924
See? I know OO and FP weren't mutually exclusive.

------
p4bl0
This is totally awesome, and fun. Also it makes me remember a work I
participated in when I was still an undergrad:

 _Can Code Polymorphism Limit Information Leakage?_
[https://pablo.rauzy.name/research.html#amarilli2011polymorph...](https://pablo.rauzy.name/research.html#amarilli2011polymorphism)

The idea is that based on a Quine with payload (similar to what QuineDB does)
we are able to produce a different but equivalent version of the code, and
replace it with this new version, so that each time it executes, the execution
trace (e.g. power leakage) is different.

------
apeace
Amazing. If you like this, you may also like Quine Relay, a quine program that
cycles through 100 different languages:

[https://github.com/mame/quine-relay](https://github.com/mame/quine-relay)

------
cs702
Love it!

quinedb can even store an 'extra' snapshot copy of quinedb, with "quinedb" as
the key, inside quinedb:

    
    
      quinedb set quinedb `cat quinedb` | sponge quinedb
    

sponge, which is part of the moreutils package, soaks up standard input and
then writes it to a file.

~~~
drchickensalad
Why not cat > quinedb ?

~~~
scott_weber
Sponge delays the overwriting of the input file, so its not trying to read and
write quinedb at the same time.

------
ashertrockman
Really clever. I am working through EOPL, and this seems pretty familiar; it's
the procedural representation of a database!

Can't wait to deploy this with my next web app.

~~~
jwiley
Whats EOPL?

~~~
ashertrockman
Essentials of Programming Languages; an introduction to functional
programming, as well as other concepts.

~~~
qwertyuiop924
EPL isn't really about FP... it's more about programming languages.

------
yolesaber
This is the perfect storage solution for my beowulf cluster

------
kixpanganiban
My favorite part of README.md:

Can I run a QuineDB cluster?

Well I mean, um.

------
m3kw9
What's a Quine

~~~
p4bl0
It is a program that produces its own source code as output.

See
[https://en.wikipedia.org/wiki/Quine_%28computing%29](https://en.wikipedia.org/wiki/Quine_%28computing%29)

------
__jal
Now that's what I call continuous deployment!

------
DictumMortuum
In the company I'm working for I'm using a bash script that keeps track of my
development builds, because I need to store multiple pieces of information for
each one that are not readily available.

For this reason I am storing stuff in a small sqlite database. If I was ever
to do this again, I would strongly consider using QuineDB instead.

------
felixschl
Love it, the Readme is hilarious. Looks like you could avoid some code
duplication though with a little awk script run by the script on its own
source.

------
smegel
Will be a perfect backend for QuineWebFramework...

