4 ms·
Dynamic languages do this with schema validation. It can be more expressive, checking value ranges or string formats, multi field conditional constraints, and s
by fulafel 8y ago
Dynamic languages do this with schema validation. It can be more expressive, checking value ranges or string formats, multi field conditional constraints, and so on. And allows better& customizable diagnostics.
Edit: also, versioning, cross language sharing, use in generative testing, api client code generation and other metaprogramming uses. And documentation generation, eg swagger
- guitarbill 8y agoSee e.g. JSON schema, which has a wide language support and tooling (even some IDEs support it for validation while you're writing a compliant document)
- roca 8y agoand once you've validated a value your code immediately forgets what type it is.
- fulafel 8y agoBeware of confusing dynamic typing with weak typing :) If you are using eg Clojure's spec, you can reference the same stuff downstream in the control flow too, for eg fn argument validation.