4 ms·
This really makes me excited, there is no reason why we cannot implement a thorough type-system like qi and shen on top of common-lisp for massive teams, the re
by serialdev 8y ago
This really makes me excited, there is no reason why we cannot implement a thorough type-system like qi and shen on top of common-lisp for massive teams, the repl experience is still unparalleled, and I for one would love more libraries popping up, so maybe more people can make a business case for it. Machine learning in python is nice, but I would definitely enjoy common lisp for it too!
- lisper 8y ago> there is no reason why we cannot implement a thorough type-system like qi The SBCL compiler actually has a type inference engine built in to it.
- lispm 8y agoMany CL implementations have a type inferencer (usually so that the compiler can optimize code without the developer having to specify types everywhere). What sets SBCL (and CMUCL and Scieneer CL) apart is that it does limited forms of compile time type checking: http://www.sbcl.org/manual/index.html#Handling-of-Types http://www.sbcl.org/manual/index.html#Handling-of-Types
- lisper 8y ago> type inferencer > compile time type checking Aren't those the same thing?
- omaranto 8y agoI don't think so. A type inferencer figures out types of expressions that don't have a type explicitly declared using information it has about other things that are declared. A compile time type checker is expected to signal errors at compile time for programs whose types don't check out. You can use a type inferencer without signaling any errors at compile time (for example, by deferring errors to runtime) and you can signal type errors at compile time even if you don't infer any types (like C compilers, that demand all variables have a declared type).
- lispm 8y agoNo. A type inference does not check types. It inferences types. For example if you know that + is defined for numbers, then you can inference that a and b must be numbers: (+ a b) If you know that a and b are numbers then you can inference that subexpressions need to deal with numbers only: (let ((a c) (b d)) (declare (type number a b)) ....) The type inferencer then will tell what types the various expressions have. It will try to propagate known types as widely as possible in the code. Allegro CL and LispWorks for example are doing this type inference. But their compiler will not tell you that type declarations are violated. SBCL OTOH treats type declarations as type assertions which can be checked at compile time. ADDITIONALLY it also does type inference - and additionally uses this information for compile time type checks.
- JasonFruit 8y ago('Infer' is a perfectly good verb; you don't have to make one out of 'inference'. But sometimes it's easy to disremembrance things like that on HN.)
- lisper 8y agoI believe lispm is not a native English speaker. His website TLD is .de.
- JasonFruit 8y agoYes, I see. Doesn't mean he or she might not rather be correct, however.
- lisper 8y agoTrue that.
- deleted 8y ago[deleted]
- lispm 8y agoThanks, didn't remember that.
- rayiner 8y ago(I feel sheepish even saying this to you), but when people say "type inferencing" I think these days they tend to mean "inference of static types that are enforced at compile time within a rich static type system." SBCL infers static types within a (mostly) dynamic, permissive type system. It can enforce certain constraints at compile time, but it’s ad hoc (there is no well-defined model of what properties it can prove at compile time on any valid code).
- lispm 8y agoType inferencing has a long tradition inside the Lisp community - for a language which is not statically typed, but which might be able to use type hints and static type information about the base language. Many Lisp compilers use type inference for optimization purposes.
- ken 8y agoIs there an alternative term which has arisen for what Lisp traditionally calls "type inference"?
- rayiner 8y agoSBCL calls it type propagation, which is fairly descriptive. (At least in SBCL, it's implemented as a data flow analysis that propagates constraints on the types of lexical variables: https://www.pvk.ca/Blog/2013/11/22/the-weaknesses-of-sbcls-type-propagation https://www.pvk.ca/Blog/2013/11/22/the-weaknesses-of-sbcls-t...).