Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

It's Time for Meta/prog/

Name: Anonymous 2012-02-20 11:55

I've been thinking, wouldn't posts be much simpler if we had some sort of /prog/ specific language to create metaposts? Writing a few lines of code to generate the content of a post is much more efficient than writing the actual post itself.


print backTo(/g/)  // Prints "Back to /g/, please!"
print isShit(Lisp) // Prints "Lisp is shit"

//This can be extended further, to use information
//obtained from the specific thread
foreach (x; thisThread.langs)
    print isShit(x) //For every language x mentioned in the
                    //the thread, prints "x is shit"

//Also has powerful mechanisms for
//parsing the content of other posts
foreach (p; thisThread.posts.mentions(Python))
    print p.num newln backTo("toilet scrubbing") //For any post that mentions Python, reference it and print "Back to toilet scrubbing, please!"


Of course, this is just a small subset of what such a language could do. I'm just laying out the basic idea.

Name: Anonymous 2012-02-20 12:44

>>1
Why bother having a print statement? Every program outputs a string, and functions should be composable. Just have every block return the value of its last statement, and have the interpreter print the return value of the main function to stdout.

If you need finer control over what goes where, then include built-in support for some kind of string builder/text stream data structure. Reserve a keyword or special syntax for the "append to current stream" operation.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List