last day (14 days later) » 

8:58 AM
19
A: Golf you a quine for great good!

FUZxxlUnix script (11 chars) I am not exactly sure if this disqualifies as You can't just read the source file and print it, but it certainly is a nice one. Taken from http://research.swtch.com/zip. #!/bin/cat

 
-1, it does, in fact, read its own source code.
 
@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ If "read the source code so it can be executed" counts as "reads it's source code," then yes, it does so. But so do all other submissions on this page.
 
@FUZxxl No, cat will read the source code to print it (twice), not just execute it.
 
@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ cat is a programming language where every program prints itself. And where do you get that cat is going to read the source code twice?
 
@FUZxxl From what you said, the source is read once to execute, and twice because cat also reads it, not just the shell.
 
8:58 AM
@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ The shell never reads the source code. Only cat does. And the kernel for determining the shebang if you're pedantic.
 
@FUZxxl So, it's a cheat! And my -1 is right, then!
 
@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ cat reads the source code to interpret it as a program. The same thing every interpreter does.
 
@FUZxxl Every cat program is a program that outputs its source code, because cat reads it, not because it is made to output it.
 
Oh come on, I hate chat.
Read the restrictions of the challenge again.
"that means that you can't just read the source file and print it. "
Which I interprete as "your program may not just read it's source file and print it."
It's not my script that is reading the source file, it's cat, the interpreter of my script.
 
@FUZxxl Or, every script reads its source file then.
 
9:03 AM
yes
 
@FUZxxl Take this program for example.
#!/bin/cat
THIS IS A CHEATING QUINE
 
Then this is a program that reads it's own source code, too:
#!/bin/sh
echo hello world
it reads its source code and then prints hello world
 
@FUZxxl For the one I posted, first the shebang gets read, then cat executes the program. Every program, while being executed, reads its own source code, and prints it, in cat. Your program will actually print hello world.
 
but it's still disqualified because it reads it's own source code
I mean my hello world program
 
@FUZxxl Oh, and chat is required, I can't do it in the comments, it's against SE's policy.
 
9:09 AM
so clearly, this is not the intent of the restriction
because then every script would be disqualified
because the interpreter reads the source code of the script at runtime
in my case, the interpreter is cat. It's not a Turing-complete language, but it suffices for the purpose.
 
@FUZxxl Take this one. #!/bin/cat saves as quine.cheat is the same as cat quine.cheat when executed directly.
 
that's the whole poinit of a shebang, yes.
similarly to how #!/bin/sh saved as script.sh is the same as sh script.sh when executed directly.
the fact that cat is a language where every program is a quine doesn't really matter for this discussion.
:-P
 
No, programs don't generally read their own source code, interpreters do. In cat though, the source is automatically printed, thus the programs read their own source code. Every character is an argument to a function that prints its argument, without a trailing newline. Thus, the program reads its own source, because the function is part of the program.
Get it?
 
No.
 
9:36 AM
You know, you have a "Downvottractive" answer, anyways.
 

last day (14 days later) »