News for hackers. Stuff that matters.
Re:12 (Really) Controversial Programming Opinions by mistercow on Sunday September 02, 2012 @02:37AM (#4466389)
Hmm, can you give an example of a typical "learning CS" level algorithm that you can't implement in, say, JavaScript?
Re:12 (Really) Controversial Programming Opinions by killahpriest on Sunday September 02, 2012 @02:50AM (#4466415)
Not an algorithm, but used in many. Pointers.
Re:12 (Really) Controversial Programming Opinions by mistercow on Sunday September 02, 2012 @02:12PM (#4467659)
Emulating pointers in JS is pretty easy; you just wrap the values in objects or arrays.
Re:12 (Really) Controversial Programming Opinions by z92 on Sunday September 02, 2012 @02:47AM (#4466411)
B-Tree indexes in JavaScript
Re:12 (Really) Controversial Programming Opinions by mistercow on Sunday September 02, 2012 @02:07PM (#4467649)
Googling around, I see a number of implementations. What's wrong with them, and why do you feel this is impossible?

(And hint: it's guaranteed not to be impossible since JS is Turing complete)

Re:12 (Really) Controversial Programming Opinions by javert on Sunday September 02, 2012 @01:45PM (#4467600)
You could probably implement any of them in JavaScript, but it would be sort of silly, because the actual runtime complexity and memory usage aren't really going to be close to what they "should be" due to the interpreter.

I haven't given it a lot of thought, but I doubt it makes sense to implement "textbook" algorithms and data structures without pointers.

Re:12 (Really) Controversial Programming Opinions by mistercow on Sunday September 02, 2012 @04:13PM (#4467975)
As I said in another thread, you can get the same functionality as pointers by using arrays or objects, which are always passed around by reference.

You're right that this is an inefficient way to implement those algorithms, but I disagree that that makes it silly. The purpose of writing those algorithms is to learn how they work, not to use them in practice. Generally, if you're using them in practice, you shouldn't be rolling your own in the first place.