4 ms·
I don't have anything against the presence of dynamic typing - it's in fact very useful. What's annoying is the absence of meaningful static typing: parametric
by catnaroek 10y ago
I don't have anything against the presence of dynamic typing - it's in fact very useful. What's annoying is the absence of meaningful static typing: parametric polymorphism and exhaustive pattern matching help me prove things about what my code does and how it can be used by others, but their usefulness is reduced to zero when dynamically typed code is allowed to break the proofs' assumptions. To be perfectly clear: it doesn't bother me in the slightest that a dynamically typed module can break the internal state of another dynamically typed module, since in most likelihood I'm the author of neither, and I respect other people's right to write their code however they wish. So I'd be fine with a Racket-like contract system, where well-typed modules can't be blamed. But, if I understand correctly, what Common Lisp has is nothing like this.
- qwertyuiop924 10y agoI don't know. I'm not a CL user. I understand that they actually do have a type system, which can be used to verify that your inputs are of the correct type and match your assumptions. As for contracts, I wouldn't be surprised if someone wrote a macro for it: they're not exactly rocket science, at their simplest. Don't ask me: I'm using Chicken Scheme, which provides both (to an extent: The documentation is worryingly vague about how the type system handles failure).
- catnaroek 10y agoChecking alone isn't the point. As things stand, it's no better than C, where the type checker can approve your code, yet it still has undefined behavior.
- qwertyuiop924 10y agoSo you want exhaustive matching? I don't know if any lisp provides that by default. One of them probably does, somewhere. But since you don't mind Lisp syntax, and really like type systems, have you tried Shen? (http://www.shenlanguage.org http://www.shenlanguage.org) it's an interesting project.
- catnaroek 10y ago> But since you don't mind Lisp syntax, and really like type systems, have you tried Shen? I also want: (0) Type inference. Shen seems to require all typed code to be manually type-annotated. (1) A decent module system. There seems to be no mention of abstract types in Shen's documentation. (2) A guarantee that dynamically typed code won't break abstractions defined in statically typed code.
- qwertyuiop924 10y agoI'm pretty sure shen has limited type inference. There might be ADTs.