3 ms·
FTA: > The C source code for this is intensely beautiful, and very concise. Go look at it! Which links to https://github.com/kevinlawler/kona https://github.c
by VMG 14y ago
FTA:
> The C source code for this is intensely beautiful, and very concise. Go look at it!
Which links to https://github.com/kevinlawler/kona https://github.com/kevinlawler/kona
This has to be a joke - just pick a random file and tell me what is beautiful about that. LoseThos looks saner than this code.
- eru 14y agoIt's concise, at least.
- stiff 14y agoThey are just writing the C interpreter in a style that reassembles the target language as much as it is possible, I guess you would have to understand some K to better understand what they are up to in the C code.
- mhd 14y agoIt brought up memories of the original Bourne shell source code which used a plethora of CPP magic to make the code look more Algol-ish, and thus similar to its final product.
- BMarkmann 14y agoKona is actually an implementation of k (not sure if he's planning to support q, which is k's successor), a cousin of J. K was originally written by http://en.wikipedia.org/wiki/Arthur_Whitney_(computer_scientist) http://en.wikipedia.org/wiki/Arthur_Whitney_(computer_scient..., and having seen some of his C code, this looks like a very similar style. Take a look here: http://www.nsl.com/papers/origins.htm http://www.nsl.com/papers/origins.htm edit: included link to a better source example
- unreal37 14y agoFTA: > "Reading his source will make you a better person, even if you don’t understand what is going on." LOL. Sure, go ahead and stare at all these classes and files with single letter (and single number) names. It will make you a better PERSON.
- andreypopp 14y agoThere's a discussion on that — https://github.com/kevinlawler/kona/wiki/Coding-Guidelines https://github.com/kevinlawler/kona/wiki/Coding-Guidelines "The unusual appearance is a side effect of writing C as concisely as possible. There are great benefits to writing code in this way. Someone familiar with the style can read and comprehend the code much faster than they could with traditional code. Brevity creates a discipline that reduces bugs. Some of the benefits will not be apparent until you try it. Some of the downsides of the style are inaccessibility and a steep learning curve."
- gruseom 14y agoThis has to be a joke Everyone has this reaction when first exposed to this class of languages and their implementations - everyone. You're unfamiliar with the style, and you're confusing that with it being ugly/unreadable/dumb. I assure you it's anything but. Now let's page silentbicycle and get him to explain :)
- argv_empty 14y agoYou're unfamiliar with the style, and you're confusing that with it being ugly/unreadable/dumb. I can't speak for GP, but I promise you I've spent plenty of time reading code with single-letter identifiers. If I'm going to have to actually understand some code, I'd much prefer descriptive names.
- jasonwatkinspdx 14y agoWhile I personally dislike this style of c, you should know that j/k/apl style languages are focused around a very small number of operators. In this sense they are a mathematical notation (and in fact, APL was designed as a rationalized mathematical notation first, programming language later). So the single character identifiers are not intended as something application specific, or mutable values. They are like +, *, %. That said, I still think it's better to stick to the conventions of the implementation language when writing an interpreter, rather than attempt to contort it half way to your target language. If you want a self hosted implementation, just write a compiler.