3 ms·
You definitely have seen it work if you've worked in any statically typed language, for example: // this will (hopefully) not compile in your favorite language
by shepherdjerred 3y ago
You definitely have seen it work if you've worked in any statically typed language, for example:
// this will (hopefully) not compile in your favorite language
int i = "Hello World"
Using type systems to enforce business logic is applying the same concept, just at higher levels of abstraction.
Usually you will want (or need) to use the more advanced type features that your language offers, like generics and algebraic data types.
There certainly is a cost to learning these concepts, but the good thing is that many languages borrow these same concepts, so the knowledge easily transfers.
- troupo 3y ago> int i = "Hello World" The gulf between this and "make invalid states impossible to represent" is a vast as the void between two galaxies. > Using type systems to enforce business logic is applying the same concept, just at higher levels of abstraction. "Just" > There certainly is a cost to learning these concepts, but the good thing is that many languages borrow these same concepts, so the knowledge easily transfers. To repeat myself: I've yet to see these claims realised not by a handful of type gurus with ad-hoc type-level DSLs, but in a more-or-less generic way applicable in every day use.