4 ms·
This SOUNDS like “types are bad”. The author’s message (towards the end of the article) is “I don’t want to infer types from my code. I’d rather infer the code
by z5h 3y ago
This SOUNDS like “types are bad”. The author’s message (towards the end of the article) is “I don’t want to infer types from my code. I’d rather infer the code from the types. Types are the spec…”
Yes. Always annotate types. Keep inference, it tells you when your annotations are inconsistent with tour code.
- kqr 3y ago> Keep inference, it tells you when your annotations are inconsistent with tour code. Isn't that plain type checking, rather than type inference? Type checking detects inconsistencies, type inference assigns types in ways that avoid inconsistencies.
- z5h 3y agoRight. I guess I meant annotate most of the things. (Top level things, complicated inner functions …) A few temporary values (next = current + 1) might go un-explicitly-typed. Anonymous functions will go untyped. I should have said “ensure your intentions with regards to types are clear”.
- cryptonector 3y agoClearly u/z5h meant that type annotations should be optional and used where not inconvenient. That's how I took it anyways.
- mrkeen 3y ago> This SOUNDS like “types are bad” No, this sounds like: * Type Inference Was a Mistake * Type Inference Makes Code Less Readable * Type Inference is a Footgun * Type Inference Wastes Academic Effort These are incompatible with: > Keep inference