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

Linked lists considered harmful

Name: Anonymous 2009-10-10 20:46

  ↑    slava_pestov 4 points 5 hours ago [-]
  ↓    A perfect illustration of why single linked lists are simply the wrong data structure in
        99% of cases. Just use arrays and you won't have to choose between tail recursion, and
        front-to-back iteration order.
        permalink report reply

Name: Anonymous 2009-10-10 23:20

>>33
But it seems to me that this extreme factoring that fans of concatenative languages rave about is actually kinda superfluous in other languages, because using variables (with sensibly descriptive names) actually makes the code clearer and removes the need for factoring it too radically.
I don't think it does make the code clearer, especially when stateful operations are performed on variables, e.g. C code. IMO, functions with descriptive names > variables with descriptive names.

On the other hand, if you don't keep your functions extremely short in a concatenative language, your code will be an unreadable mess.
I don't really agree with that either. Long functions can be readable if they have some kind of sane structure, for example a cond or initializing slots in an object. Unreadable long functions that need to be refactored do exist, but aren't just a product of concatenative languages. While they might be easier to decode in a language that makes more use of variables, that doesn't mean they wouldn't benefit from refactoring. If refactoring long functions shrinks your entire codebase, I can only see extra motivation to do so as a good thing.

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