This code is basically obfuscated by hand. Absolutely unapproachable. Only the original author(s) can understand it.
Judging by other comments, it seems to work well. So they seem to be good programmers producing working code. It's just not intelligible by other human beings, which is a pretty bad thing, but not the only factor in software quality/health.
The Vim code base is at some parts straight batshit insane, but it's one of the most polished programs I've ever used.
All that being said, I would find infuriating to work with such code. Nope!
And it is not for all people.
But it's just a foreign language; You could look at Japanese text[0] and make similar statements, and would be just as valid (or rather, invalid) as your statement.
You expect to be able to read it because you're used to a class of languages which are all similar enough at the surface level -- perhaps you are even familiar with more than one fundamentally different classes, say, "lispish and algolish" or "germanic and latin". But that doesn't make APLish or Japanese[0] horrible.
This is just APL using C syntax.
[0] assuming, the proverbial you does not know Japanese
Just because you find it strange, it does not mean it's strange.
I'm sure you'd find languages in Papua New Guinea difficult at times, and you'd argue English is "better" because more people speak it, and there is a richer literature in it, but the ideas expressed in those languages - and how they are expressed uniquely in those languages - are valuable to the people who speak them.
I'd be very interested to learn more about which semantics of APL-derivatives correspond to which of the 4 or 5 distinct meanings of the keyword 'static' in C.
It's not in the "k.h" header, though that references it also.
Maybe the build system injects it through the compiler command line or a forced-include header. Though the gcc command line alluded to in the block comment header shows no evidence of that.
Edit: Found it! It's a typedef for a pointer to a struct k0:
typedef struct k0{signed char m,a,t;C u;I r;union{G g;H h;I i;J j;E e;F f;S s;struct k0*k;struct{J n;G G0[1];};};}*K;There are a handful of helper functions to get/set various parts of this structure, and most of the functions in the language (and its implementation) take 1 or 2 of these and return 1.
This approach helps me find bugs and repetition in my programs which makes my code shorter and faster as a result.
What we're looking at here is some of its C implementation internals. They are using short identifiers and the C preprocessor to help with terseness. The justification is that this is "like APL". But there is enough C cruft there that it's not really like APL. A possibility would be to generate whatever code those C macros are generating, but with some other preprocessor which polishes the notation a little bit.
Even if those analysis tools and debuggers were developed for Q, they likely wouldn't apply to this code.
personally, i disagree with them on debugger. would be nice to have one.
Even if they can do things you cannot do?
What are you doing here if so freely admit you have a closed mind?
The argument is that my programs are shorter and faster and more correct?
> I don't think it's a good idea to use this extreme single-character, single-line style in languages not designed for it.
You think if I need to write C, that I should do things that make my program larger and slower and less correct?
That doesn't make any sense to me at all.
Yes (marginally), when those things are at odds with the tools and conventions of C, because there are serious downsides you don't list. Compiler error messages will be difficult to understand. Tools for code analysis and debugging will be less useful or even completely unusable. Most importantly, because your personal style is alien to other people you lose the ability to collaborate with other developers.
A language designed for this would mitigate most of those downsides.
If you don’t put bugs in the first place this causes very little problem in practice.
> because your personal style is alien to other people you lose the ability to collaborate with other developers.
Another solution is to expand the program by adding white space and long identifiers after it is written.
This works better for me since if someone wants to change my program it’s because they want it to do something that I didn’t.
Using multiple lines and indentation doesn't change executable code.
They make the source code larger.
That makes it harder to read.
what can be greater than this?
Oops, I see we are devolving into Reddit. Alas, at least the end is near; recursion bottoms out at 4chan which is just one stack frame down.
Or this wall of code:
https://github.com/KxSystems/kdb/blob/master/c/c.cs