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.
>>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.
Name:
Anonymous2012-02-20 13:19
>>6
print backTo("whence you came") newln
print "We don't take kindly to Python-loving mental midgets here"
Name:
Anonymous2012-02-20 15:32
>>6
No need for special syntax if you have string buffers backed by immutable strings.
How important is to have random-access strings? Most [useful] processing is done with pattern matching or simple iteration anyway.
Name:
Anonymous2012-02-20 15:55
let a := "hax my anus"
for i from 0 -> 10 do
a
Outputs:
"hax my anus"
"hax my anus"
"hax my anus"
"hax my anus"
"hax my anus"
"hax my anus"
"hax my anus"
"hax my anus"
"hax my anus"
"hax my anus"
Name:
Anonymous2012-02-20 15:56
You could do this with D
Name:
Anonymous2012-02-20 15:59
print 9.refNum //Prints ">>9"
for a=0..10
print "fuck off " + fagQuotes(faggot) newln newln
print backTo(/g/)
Name:
Anonymous2012-02-20 16:12
>>11
let a := "Fuck off faggot with your hipster language that looks like shit\nBack to /g/ with you faggot."
for i from 0 -> 100 do
a
>>8
Yeah, I can't remember the last time I saw random access of strings. And special syntax isn't necessary anyway. The syntax could be the same as a function call. It doesn't matter. I just thought it would be neat to have an "append this to the current output buffer" ability, especially if there's an output buffer particular to the local scope.
Name:
Anonymous2012-02-21 10:38
>1 is shit
It works!
Name:
Anonymous2012-02-21 10:58
Inb4 we could actually do this with Perl or Javascript.