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

Towards a better BBCode

Name: !Xarn.JCoew 2010-05-24 20:28

cairnarvon@feynman:~$ cat hello.txt
Hello {spoiler /prog/}.

What do you think of my {sup new} syntax for {i {sup B}{sub B}code} based on S-expressions? It supports {b.i.u function composition} and {sup*2 iteration {sub*3 (and nesting, obviously)}}. It uses curly braces {m \{\}} rather than the traditional {b (}parentheses{b )} because that will require less escaping.

{aa No more unmatched or misnested tags!}

I've written a {spoiler.i terrible} FIOC {i.m SexpCode-to-BBCode} translator, which you can find here: http://sprunge.us/KPWB?py
cairnarvon@feynman:~$ python sexpcode.py < hello.txt
Hello [spoiler]/prog/[/spoiler].

What do you think of my [sup]new[/sup] syntax for [i][sup]B[/sup][sub]B[/sub]code[/i] based on S-expressions? It supports [b][i][u]function composition[/u][/i][/b] and [sup][sup]iteration [sub][sub][sub](and nesting, obviously)[/sub][/sub][/sub][/sup][/sup]. It uses curly braces [m]{}[/m] rather than the traditional [b]([/b]parentheses[b])[/b] because that will require less escaping.

[aa]No more unmatched or misnested tags![/aa]

I've written a [spoiler][i]terrible[/i][/spoiler] FIOC [i][m]SexpCode-to-BBCode[/m][/i] translator, which you can find here: http://sprunge.us/KPWB?py


Hello /prog/.

What do you think of my new syntax for BBcode based on S-expressions? It supports function composition and iteration (and nesting, obviously). It uses curly braces {} rather than the traditional (parentheses) because that will require less escaping.

No more unmatched or misnested tags!

I've written a terrible FIOC SexpCode-to-BBCode translator, which you can find here: http://sprunge.us/KPWB?py

Name: Anonymous 2010-05-24 22:18

>>24
you don't know how Python handles strings
That's funny because you don't seem to know shit all about what I know, and perhaps even less about the subject you're pretending to be so all-knowing about. Try looking it up, += in a loop is most certainly slower than "".join(list), and strings are immutable. Full stop, there's no room for argument.

And: while there has been some work done in Python 2.5 in regards to optimizing strings, other implementations (IronPython, Jython, etc.) are not nearly as well-optimized there, and implementation regardless, joining a list is still on average at least 20-30% faster even with the most recent Python version, it consumes less memory, and is also quite a bit easier on the GC.

It doesn't mean much on a small scale with a single post, but go ahead and use code like that on an app server that's processing several posts a second. Shit like that is why people think dynamic languages are so slow; they don't bother learning how they are actually implemented.

(And by the way: how about that code stepping through the input stream one character at a time? Jesus!

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