<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 3, 2023 at 6:06 PM Dan Cross <<a href="mailto:crossd@gmail.com">crossd@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, Aug 3, 2023 at 11:21 AM <a href="mailto:will.senn@gmail.com" target="_blank">will.senn@gmail.com</a> <<a href="mailto:will.senn@gmail.com" target="_blank">will.senn@gmail.com</a>> wrote:<br></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail_default" style="font-family:"times new roman",serif;font-size:large"></span>someone had needed to store a<br>
pair of integers, so they used a CONS cell;</blockquote><div><br></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">Of course, that was a bad idea. The pair of integers should have been a struct or a class named after whatever its application-level purpose was: a point, for example.</div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">after a while, the pair<br>
needed to be expanded to a triple, so someone converted the single<br>
CONS cell into a (proper) list.</blockquote><div><br></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">In that case, a derived struct or class should have been created. The two classes would use the same accessor methods, just as in C++.</div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">this, of course, ran afoul of the type system and<br>
raised a condition, which resulted as an ISE in prod. The fix was<br>
trivial (change CDR to SECOND in the right place) but it really struck<br>
me that if the system were statically typed, this would have been<br>
trivially discovered at compile-time.<br></blockquote><div><br></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">Absolutely, and if the failure was intolerable, CL's static type declarations would have caught the use of the wrong type. But you don't have to declare *everything*. For that matter, there is nothing in a fully statically typed system that requires every variable, function, argument, etc. to be *declared*: type inference is powerful.</div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Common Lisp does allow you to declare types in some limited regards;<br>
these are usually hints to the compiler for code generation.<br></blockquote><div><br></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">They may or may not be, depending on how you set the OPTIMIZE declaration.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">like Rob, I<br>
greatly prefer strong, static typing.<br></blockquote><div><br></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">Then why weren't you using mypy?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Incidentally, C is weakly (you can add a pointer to an integer: the<br>
result is another pointer), but statically typed.<br></blockquote><div><br></div><div class="gmail_default" style="font-family:"times new roman",serif;font-size:large">That's not weak typing, it's operator overloading, just as when you add an int to a double. C will not let you, e.g., add an int to a function. Weak typing is quite rare in high-level languages: PL/I pointer variables are weakly typed (that is, when you allocate an object you specify the type of the object and then assign it to the pointer variable), but the rest of the language is strongly typed.</div></div></div>