5 ms·
* Types that can actually restrict values. I think Haskell does this, but you should be able to express something like "X is an integer whose value is always g
by curryst 5y ago
* Types that can actually restrict values. I think Haskell does this, but you should be able to express something like "X is an integer whose value is always greater than 1" and have the compiler implicitly perform a check when you cast to X.
* Enumerated errors. Some part of the tooling should be able to tell me all the errors that a function could raise. I don't know why this isn't more common, but sometimes errors are not of the type that I would have expected for the failure, or I don't know what type the error might have (i.e. there isn't usually a stdlib error for an HTTP 503 in a client).
* Optional static typing or a "loose syntax mode". Even if they don't behave exactly the same, it would be great to be able to do rough prototyping and production-ready work in the same ecosystem. Imagine if Python and Go or Python and Rust used the same ecosystem, and libraries were usable in either. You prototype in the loose Python syntax, and tighten it up to the Rust syntax when you're happy with the prototype.
* Macros. I don't think any language is ever perfect, and macros give you a means to work around warts in the language. They're complicated to write and maintain, but I still think it's often better than dealing with the nasty side of a language.
- jgwil2 5y ago> Optional static typing or a "loose syntax mode". This sounds like what TypeScript offers with the `any` type: you can use it to shut down the type system at a given point and then gradually replace loose types with stricter types (hence the phrase "gradually typed")
- dmux 5y ago> Enumerated errors. Some part of the tooling should be able to tell me all the errors that a function could raise. I don't know if I'm missing the mark here, but aren't you describing Checked Exceptions?
- andrepd 5y ago> Types that can actually restrict values Do you mean run-time checks? If yes then all you need is a normal oop class with an `assert` in your constructor. If you mean compile-time checks then that's a much much harder problem. > Enumerated errors If you have sum types/enums then enumerated errors are just a normal enum. Like type err = FileDoesntExist | PermissionError | NoDiskSpace type result = Ok file | Err err
- Jeff_Brown 5y agoI believe he means compile-time checks. Th formal term for this is dependent types. Some languages offer it. Haskell is working on making it ergonomic. It's already quite ergonomic in Idris.