2 ms·
> you don't need to be able to have the compiler enforce constraints Expressing such constraints and having the language/compiler enforce them is part of what
by karmakaze 4y ago
> you don't need to be able to have the compiler enforce constraints
Expressing such constraints and having the language/compiler enforce them is part of what I want from an expressive language. That way once I've expressed them, I don't have to ensure those things repeatedly for the entire lifecycle of the program. We each have our definitions and values.
- lolinder 4y agoI should be clear that I personally agree with you 100%—I prefer to outsource as much as I can to the compiler. It's just that I also recognize that that means being unable to express some things that are otherwise possible, and that most developers don't like that trade-off.
- karmakaze 4y agoI don't know what you mean. Just because C++ has "const", you can still make a method that doesn't mutate without the keyword. Seems like a "No True Scotsman" definition of expressiveness.
- initplus 4y agoI feel like this doesn't make sense because mainstream functional languages all provide a way to express imperative code. In Haskell you can write an entire application using IO/do blocks and it will be completely imperative. In f# you can declare every variable mut. Functional languages don't prevent you from writing imperative code. They give you the opportunity to choose not to, and enforce it at compile time. The opposite is not true of imperative languages, there the type system cannot help you to enforce that some code is purely functional.