2 ms·
Sure. You could leap to the best solution first. Probably, you lucked out in the gene pool and your future fate is not to write bad code. The rest of us, who di
by ggm 9y ago
Sure. You could leap to the best solution first. Probably, you lucked out in the gene pool and your future fate is not to write bad code. The rest of us, who did not acquire sufficiently complex frontal lobes, struggle with concepts and probably dive into stupider solutions first, like I did at uni in the 1980s allocating a fixed size buffer (big initial mistake)_ and maintaining a huge linked list of edits sequence events into it.
I passed the course, but future evidence suggests I didn't learn as much as I hoped!
- greglindahl 9y agoHa ha, well, I'll confess, I got lucky and discovered the existence of gap buffers before I tried to write a simple editor. And these days, there's a Wikipedia article on quite a few of the fundamental editor data structures. It's worth noting that no widely-used editor since emacs uses a gap buffer, so it's not like it's won the hearts and minds of implementers.
- eftychis 9y agoI wouldn't say a gap buffer is the "complicated and crazy" data structure for text editing. Certainly not the best. There's no free lunch, every approach has its downsides :)