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.
Re:Unix as IDE
by qwertyuiop924 on Thursday October 06, 2016 @07:49PM
(#12657086)
I 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).
Checking 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.
Re:Unix as IDE
by qwertyuiop924 on Friday October 07, 2016 @05:59AM
(#12659384)
So 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) it's an interesting project.
> 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.
Re:Unix as IDE
by qwertyuiop924 on Friday October 07, 2016 @11:29AM
(#12661411)
I'm pretty sure shen has limited type inference. There might be ADTs.
Given, it can be unpleaseant in certain contexts, but Lisp has really good metaprogramming support, so you can add syntax for a runtime type system relatively simply. It's not optimal, and it certaibly isn't the fastest thing, but it works if you want it.
And nowadays, CL (and several of the Schemes) provide more powerful type systems, and sometimes even compile-time typing. All optional, of course.