I mean, today I was trying to write a very simple parser for some very simple markup. The optimal code wouldn't need to traverse the markup more than once to parse it. It is that simple. Yet I couldn't find a simple way to do it in JavaScript. Almost all string methods mean that I'd need to traverse the string at least two or three times. Fine, fuck those methods. I resolved to traverse it "manually" character after character using a queue and a stack to keep track of things. Well apparently there aren't any decent data structures provided. Well fuck. I know I can probably find a decent third party library but I hate working in such an enviroment.
However, here's the thing. I still love Node.js and asynchronous programming. It's really ironic. JavaScript on a whole is a very inefficient POS but the basic premesis of Node.js is very elegant and simple.
So I resolved to do either of these.
1. Ditch Node.js altogether and use Erlang.
2. Keep Node.js as the final glue-code and use C or Haskell for anything other than the very basic stuff.
What would /prog/ suggest?
Name:
Anonymous2012-07-22 11:08
I'm a fan of option 1 anon. I try to avoid using java/javascript at all costs.
Name:
Anonymous2012-07-22 11:13
Seriously, FUCK javascript. I'm with you 100%. It always finds a way to be annoyingly complicated no matter how simple the concept.
Name:
Anonymous2012-07-22 11:29
I don't know what you people are doing wrong but I don't think I'm a good enough programmer to criticize you for it.
Honestly, what are you people doing wrong?! even with just the tools available, this shit's easy.
The problem you have is that you like the language, but the standard library it provides is shitty. You can fill in the gaps by extending the library with C or more javascript, and it could meet your needs. But then your code will depend on these extensions. You could imagine the frustration of someone wanting to use your code with someone else's when both provide different C extensions that both provide the same functionality. This problem is avoided if the language meets all your needs out of the box. But it can't, because it was designed to only be a web scripting language. Traditional file io doesn't even exist in that environment. The only real solution is for there to be a central repository for all javascript extensions. That way, people can find existing extensions before implementing and using their own. But it is still more complex than just using a language that meets your needs out of the box.
The actual problem is: Node.js is great (maybe the best platform to write web apps) but Javascript sucks.
Erlang is a nice language, but I would recommend to try Haskell and Yesod first.
Name:
Anonymous2012-07-22 16:23
Erlang is a good language conceptually, but the syntax is a sheer abomination. Use something more uniform, like Lisp.