Typed Lisp, a Primer (2019)
alhassy.github.io
alhassy.github.io
and also:
- https://medium.com/@MartinCracauer/static-type-checking-in-t... (by an author of the CLASP implementation, C++ & LLVM for CL)
- https://github.com/stylewarning/coalton - a library (pre-alpha): adding Hindley-Milner type checking to Common Lisp which allows for gradual adoption, in the same way Typed Racket or Hack allows for. It is as an embedded DSL in Lisp that resembles Standard ML or OCaml, but lets you seamlessly interoperate with non-statically-typed Lisp code (and vice versa).
Can you elaborate on what you mean by that?
I do think there might be some middle ground where you can annotate non pure functions in order to help the compiler with aggressive optimization.
So you put it in a monad and get on with your life? It's like one or two extra characters on your operators just to mark out where you're doing effect composition, and the benefit is that you can immediately see where all the effects are happening. Code is read more than it's written, so it's a really good tradeoff.
> And yet it works incredibly well with good enough performance for a wide band of applications!
How big is it, and how many people work on it? IME not tracking effects works great as long as everyone working on the codebase can keep the whole thing in their head. But you hit a wall (for me it's about 20kloc - I'm sure smarter people can push it a bit further, but everyone will have a limit eventually) once you can no longer reason about how one part affects every other part, and at that point a little helping hand from the compiler helps a lot.
(define (f1 x::String y::String) (x:concat y))
(define (f2) (f1 3 3))
;; /dev/tty:3:19: warning - type integer is incompatible with required type java.lang.String
;; /dev/tty:3:21: warning - type integer is incompatible with required type java.lang.String
;; /dev/tty:3:15: warning - cannot convert literal (of type gnu.math.IntNum) to Type java.lang.String
;; /dev/tty:3:15: warning - cannot convert literal (of type gnu.math.IntNum) to Type java.lang.String
Unfortunately it does not support fully static type checking nor generics, otherwise it would be my favorite scripting language hands down.As for type checking Elisp, Elsa[1] seems an interesting project and I hope it becomes a stable option. On the other hand I wonder if in future type checking could also come from gccemacs[2], since one of the "long-term improvements" may be "better compile time warning and errors relying on the propagation engine".
[1] https://github.com/emacs-elsa/Elsa [2] https://akrl.sdf.org/gccemacs.html
Edit: grammar.
And if you feel like types are too constraining for a part of your code, you can just leave them out. You get the best of both worlds!
http://planet.racket-lang.org/package-source/untyped/seleniu...
What I need is to make a diagram from a file produced by diagrams.net without me writing the parser (JGraphX can already parse diagrams.net's xml), show me a window where I can select and adjust elements by hand, transform the diagram programmatically in a language where I have both type-checking and good completion for (eg) the selected objects, export back to diagrams.net's format. Occasionally I want to extend the already interactive window myself. I also evaluated Typed Racket before picking Kawa and the JVM, but JGraphX was just a more appropriate tool for this specific workflow.
> There's also this (and others) for selenium
I remember finding that, and I counted it as a subset of Selenium's functionality rather than equivalent.
I agree on the sentiment on Racket though, as for the language itself Java was a second choice for me. What eventually convinced me to invest in it was that I could always call what I had already written from other languages on the JVM (mainly Scala and Kawa, which also happen to have decent repls) without writing any glue code.
There's no reason why you can't have types and contracts though. I personally can't live without compile time guarantees.
With my typing trouble I should have come to the user list and asked, but I dId not, frustrated and thinking I was too stupid to get it ^^'
I did once at least see a question on the mailing list, where the answer was, that typed racket could not do it, as in infer types, so it might not be perfect yet, or perhaps it did improve since then.
I wish more Schemes could just copy the typed part of typed racket, using that macro language, as in theory they should be able to represent it, but I guess the devil is in the detail and slightly different workings of macro facilities.
Do you think it is not possible to express these things in syntax-case? And if so, why?
And in C# at least contracts can be disabled for release builds so that the performance penalty is only inflicted on the developers.
[1] https://docs.microsoft.com/en-us/dotnet/framework/debug-trac...
"GPL compatible: Optionally but not by default[3]"
[1] https://clojure.org/community/license [2] https://groups.google.com/forum/#!topic/clojure/uWAWm0xqrTI
[1] https://pmsf.eu/pub/cmucl/doc/cmu-user-old/compiler.html#toc...
>type's have always been there
I've seen this argument before and, I disagree with this statement as presented. The implication is that there is a type system underlying a language's semantics. But, really that's not true. It's more correct to say that objects have always been there.