5 ms·
Are we looking at the same file? It has masses of high quality comments. I think calling this stringly typed is unfair. Basis names appear to be strings with
by BorisTheBrave 7y ago
Are we looking at the same file?
It has masses of high quality comments.
I think calling this stringly typed is unfair. Basis names appear to be strings with some densly coded information in them, and can sometimes take the values "-1", "0" or "1". But they're not integers, and it matches the mathematical notation used very closely.
I see plenty of 1 character variable names, but the vast majority are either loop variables, or have a comment near the top of the file explaining their meaning, or are the only argument on a commented/named function.
I see plenty of regexes, but they are all extremely short matching patterns.
So it looks pretty good quality to me. Extremely densely written, typical for the "genius mathematician" programmer, but with some effort put into clarity.
- jiggawatts 7y agoAre we? The comments are all of the style "now, this is the thing that is the thing". None explain anything at all other than to give names to variables or functions. Which you know... can already be named using identifiers in the language. What are the matrices of constants? Where do they come from? What do they mean? What is their purpose? What are the random indexes into arrays? What do they do? This is one of the first "comments": // Documentation below is for implementors. I'll assume you know about Clifford Algebra's, grades, its products, etc .. // I'll also assume you are familiar with ES6. My style may feel a bith mathematical, advise is to read slow. I don't know about you, but whenever I see a comment littered with typos that says "this is a bit hard to read", it's a sure sign that whatever is to follow is of low quality. Not reusable. Not suitable for widespread use. Not extensible. Not useful at all. To reiterate: this makes me sad. I really wish it didn't, because GA is one of my favourite things, and this Enki Mute guy is clearly one of the few people that also "gets it" and wants to spread the good work. Clearly, his heart is in the right place. I know people like this guy. I went to University with a chap who would casually litter his Haskell code with 5 dimensional arrays of functions. Now I'm sure that made sense in his head, and his code actually worked, but no human being on Earth other than him could read it. He couldn't explain to me even verbally, let alone in comments. Unfortunately, while Enki Mute could have made a great contribution, his methodology has not helped GA become more approachable.
- BorisTheBrave 7y agoAll the major arrays are named after mathematical constructs you can find defined elsewhere. There's examples of them in the docs, and the describe function dumps them out for you. The hairiest parts of the code and where he deviates from mathematical convention have more in depth comments (e.g. simplify, simplify_bits, inline). Much of meaning and purpose is explained by that top coment - go read about Clifford algebras elsewhere. That seems an entirely reasonable approach to me. Indeed, I read the wikipedia page briefly, and already the code made a great deal more sense to me. So I think his position is justified. So I really cannot see how you see this falling short. Perhaps this is about expectations. You obviously wanted code that teaches, as well as functions. Maybe you were also expecting more object orientation, more spread out code? Well, those were not part of the authors plan, but don't alone make it bad code. Seeing as this functions as a code generator, frankly, the output is a better teaching tool - one can look at the rust generated for, say complex numbers and dual numbers, and immediately see which parts are in common, and which parts are different. That makes you think about what other things could fit the same template, which is basically what clifford algebra attempts to answer.