r/HyperApp • • Aug 01 '17

Annotations, please?

What attracts me about a codebase this small, is the ability to actually fully understand precisely what I'm working with, how it works, inside and out.

Unfortunately this code has no annotations at all, which makes it very difficult to read and understand - I can't tell what the types of anything is, whether properties, vars, return types etc.

I'd like to encourage the authors to either port to Typescript, or add Flow or JSDoc annotations - even though this codebase is small, the shapes of the object graphs being built is pretty complex. Proper documentation would go a long way in helping someone understand the data shapes and learn the roles of various vars and properties and so on, which would make this project a lot more accessible, which would likely get more people on board faster.

Just my $.02

7 Upvotes

2 comments sorted by

View all comments

Show parent comment

1

u/mindplaydk Jan 07 '18

Yeah, I wish someone would figure out how to apply these optimizations mechanically, e.g. figure out how to implement them as options for uglify and PR that instead of garbling actual code.

For example, hoisting vars to function parameters to save 3 bytes ("var" keyword vs "," in the function declaration) is something that confused the heck out of me - I had never, ever heard of that, and the extra arguments make it very confusing and weird to try to read function headers. It must be possible to implement that one as an AST transformation rather than messing up the actual code?