Remix.run Logo
wrs 7 hours ago

On the other hand, it would be easier to add type checking to a Lisp than it was to Python or JavaScript, and I don’t know any technical reason you couldn’t. A little Googling shows it’s been experimented with several times.

nine_k 6 hours ago | parent | next [-]

Well, Typed Clojure is a thing!

But the real strength of Lisp is in the macros, the metaprogramming system. And I suspect that typing most macros properly would be a bit less trivial than even typing of complex generic types, like lenses. Not typing a macro, and only typechecking the macroexpansion would formally work, but, usability-wise, could be on par with C++ template error reporting.

wrs 6 hours ago | parent [-]

My point was that you could implement type checking with macros, not that you could type check macros. (Though that would be cool!) As opposed to having to change the language definition first (Python) or implement an entirely new compiler (TypeScript).

nine_k 5 hours ago | parent [-]

Certainly you can implement the typechecker with macros, but it should also work on macros, before expansion. That is, you likely want (-> ...) typechecked as written, not (only) as expanded, and typing errors reported on the non-expanded form.

andersmurphy 5 hours ago | parent [-]

Right the same way the type checker should check the type checker.

teaearlgraycold 7 hours ago | parent | prev [-]

That means little to a programmer unless they really want to spend thousands of hours building a type checker before starting a project.

wrs 6 hours ago | parent [-]

Talk about moving the goalposts! Did you implement TypeScript yourself before using it?

teaearlgraycold 6 hours ago | parent [-]

The parent comment implies that the tool does not exist yet.