3 ms·
A sound type system would have guaranteed that no program execution ever calls your function foo with the wrong type of argument. SBCL doesn't offer any such gu
by YouAreGreat 8y ago
A sound type system would have guaranteed that no program execution ever calls your function foo with the wrong type of argument. SBCL doesn't offer any such guarantee.
If some part of your program extracts values from a heterogeneous list and calls foo on one of them, SBCL will not be able to statically guarantee that it is a FIXNUM at runtime. It can't reject the program either, that would require seriously subsetting the language.
- _ph_ 8y agoSBCL will issue a compile warning, that it cannot guarantee that you call the functions only with FIXNUMS.
- deleted 8y ago[deleted]
- YouAreGreat 8y agoWhoa. Will SBCL emit false-positive warnings all the time when you dare to use lists in a Lisp, or does it at least try hard to infer specialized list types, going above what's expressible using the standard LIST type?
- _ph_ 8y agoNo it doesn't emit false positive warnings when using lists. That is FUD. But if a function explicitly requires fixnums, and you pass something of type t, it might warn (depending on the optimize settings).
- YouAreGreat 8y agoYou didn't answer the question if SBCL infers specialized list types. I'll assume the answer is "no". In that case, everything extracted from a list is T and you'd have to get that warning you mentioned above. Such warnings would very likely be false-positive, unless Common Lisp programs are buggy as hell most of the time—assuming that would be the real FUD, no? Therefore, the non-FUD conclusion is to expect a high rate of false-positive warnings in typical list-using programs. TBH, I suspect those false-positive warnings you mentioned aren't bona fide warnings, but some kind optimizer stream-of-consciousness log stream.
- _ph_ 8y agoList elements are of type t, and of course acceptable to pass to all functions which take t as an argument, so no false-positive warnings.
- YouAreGreat 8y agoAre you saying that the happy path of SBCL static typing—given you also want to use lists, and also not be inundated with spurious warnings—is to declare everything to be of type T?
- _ph_ 8y agoNo, I am not. Perhaps you read up a bit about Common Lisp and SBCL before we continue the discussion.
- deleted 8y ago[deleted]