4 ms·
Is K [0] in some sort of competition with J [1] about who can write worst, most unreadable and unmaintainable C code possible? [0]: https://bitbucket.org/ngn/k
by OskarS 7y ago
Is K [0] in some sort of competition with J [1] about who can write worst, most unreadable and unmaintainable C code possible?
[0]: https://bitbucket.org/ngn/k/src/master/m.c https://bitbucket.org/ngn/k/src/master/m.c
[1]: https://github.com/jsoftware/jsource/blob/master/jsrc/v2.c https://github.com/jsoftware/jsource/blob/master/jsrc/v2.c
- atemerev 7y agoThere are people who value brevity and minimal amount of code above everything else. Arthur Whitney, the author of K, doesn't even use scrolling — everything he reads or writes has to fit on a single page.
- tgv 7y agoBrevity should not be an excuse for obscurity and illegibility. I get it that you assign a short name to central data structures, but all those two character identifiers...
- tluyben2 7y agoAs this thread and post proves, quite a lot of people have no issue reading + understanding it. One of the goals to fit a lot of functionality on 1 screen which helps, especially when you get older, but it always helped. No scrolling, searching, trying to find in which abstraction in which of the 1000s of files with 'readable' code things are stored. You open 1 file and yes it will take you (a lot) more time to read the same length (in lines) page of, let's say Java or C#, but in those languages you will need often 10s, 100s or even 1000s of these pages (in many different files because that's 'readable') to write the same functionality idiomatically in that language as that one pager in this style. So people who take the patience to read and understand this will actually be more productive in my experience: I am claiming that it will take most people (a lot) more time to read and understand this code if it was written in a traditional way in C or whatever, with proper variable names, spread over many nicely created .h and .c files than it takes someone who has done this before to understand and work on this. And that gets more obvious when you actually start using APL/K/J which allow even more expressiveness into the language and will let you even compress more functionality in less characters. However it does not naturally scale to teams. But each way of working has its own strengths and weaknesses; if you are aiming for large teams working together on large projects, I would not recommend this. That is not because of readability, but because the code is so terse that you would, even with 2 people, be changing the same code a lot of the time, so it's more efficient to do it alone or in pair programming (which does work well; also remotely in an APL-like in my experience).
- msla 7y ago> As this thread and post proves, quite a lot of people have no issue reading + understanding it. This thread, like this implementation, is a troll, a joke, and everyone trying to appreciate this thing as a language is being pranked.
- kick 7y agoThink of it like it's math. If you have to explain the value of e every time you use it, the value of your work to onlookers diminishes, and it can no longer be held in the mind of any reader.
- kick 7y agoSnide remarks are dull, and HN's guidelines explicitly recommend against cheap humor. Every time K is posted to HN someone makes this exact style of comment in an attempt to be funny, but it's entirely unoriginal. There's good reason as to why C written by APL programmers looks as it does, and shallowly dismissing it does a disservice to everyone.
- msla 7y agoI still wonder if this is the form the author of the code uses to write the program.