8 ms·
:) i was waiting for you to come all lisp on me! (eh i just realized your pseudo) [sorry for the long msg, i like this topic!] But this is just all staging! I
by lapinot 4y ago
:) i was waiting for you to come all lisp on me! (eh i just realized your pseudo) [sorry for the long msg, i like this topic!]
But this is just all staging! I would never say that lisp is not typed! Only perhaps streaming lisp interpreters (perhaps like lisp machines, don't know them very well) could be said truly untyped (actually: trivially statically typed). Dynamic vs static is more precisely seen as a sequentiality between stages, and you can have several stacked stages and even looping (as in lisp). But the distinction (in lisp still) between something that is quoted (a next-stage computation encapsulated into what is currently data) and current-stage computation is pretty clear. Some function bodies eval quoted stuff and some build quoted computations and you can statically see that: you can type it (using a quoted vs normal modality on top of any type system you already have). We could also talk about erlang.
In fact the trend is that for every convoluted language semantic that has traditionally been seen as dynamic/permissive/untyped, the research oriented world has come up with type systems explaining these languages. I talked about gradual typing earlier in the thread. There is static typing for memory state, complexity constraints, timing, validating interface checks, for well-typed macros and syntax reflection. Typing in some way is just structuring the mathematical semantic of your language. It can always be done, even after the fact, usually in tons of different ways.
I see where you come from, but still, actually i do believe there is a "deep underlying mathematical truth" in the sense that this sharp definition (typing is static) will help you to understand things because it's a deep concept. And as any deep concepts usually when you think you hit it's limit, you understand that you can generalize it into something that is more abstract but still has the core properties. The concept is still there, just said in more precise terms (more precise, because you're taking more parameters and leaving more irrelevant choices open in the concept, hence more abstract).
> In fact it is so-called "strongly typed" language that are lacking something, namely, the freedom to write code that does not conform to the constraints of the "type system".
This is wrong if by "strongly typed" you mean the term of art: you'd have to be willing to go out of your way to write a compiler for a language without any appearance stuff that could be qualified static typing. Static scoping and dependency analysis is a strong type system where types are the number/name of free variables. Compilation of call-conventions, memory layout and memory allocation interfaces can be done at scale with type systems (the llvm one is well-known, you'd be quite in the minority saying that llvm constrains you not to write your "untypable" self-mutating program). For most part, in practice, type systems are not a feature of the language but of the compiler, as for tons of cool systems, types can be infered (by a complete deciding procedure). Static type systems are just the fact that you will annotate programs with some local invariants, whatever they might be, to ease manipulating and reasoning on some form of term representation (AST, call-graph, ..).
- lisper 4y ago> I would never say that lisp is not typed! I didn't say you would. What you said was... > > Having dynamic typing != no type system. > Actually no, not in programming language theory. Which implies "having dynamic typing == no type system", which is just wrong, even in programming language theory. These two things are just completely orthogonal to each other. One is a compile-time thing and the other is a run-time thing. Any language can have either, or both, or neither. (And BTW, none of this has anything to do with my original objection, which was your abuse of the phrase "type system".) > the distinction (in lisp still) between something that is quoted (a next-stage computation encapsulated into what is currently data) and current-stage computation is pretty clear I'm sorry, but this is nonsense. Your understanding of Lisp seems to be about 50 years old. The only distinction between "something that is quoted" and something that is not quoted is that the former was produced by the reader (and in CL is stipulated to be immutable, but that is neither here nor there) while the latter may or may not have been. But even the Lisp reader can do arbitrary computations, at least in CL. So I have no idea what "current-stage computation" can possibly mean. You can run your entire program at read-time in Lisp if you want to. > i do believe there is a "deep underlying mathematical truth" in the sense that this sharp definition (typing is static) will help you to understand things because it's a deep concept. No, I disagree. Static typing is nothing more than a particular kind of partial evaluation under a set of constraints and assumptions that adhere to certain conventions. There is no magic in it. The study of type systems is nothing more than the study of the trade-offs that come from different sets of constraints and assumptions and conventions. At the end of the day, bits go in and bits come out, nothing more. Anything beyond that is just in the eye of the beholder. This is not to say that the eye of the beholder doesn't matter, only that the value of any structure you impose on your bit streams, whether you choose to call it a "type system" or not, is necessarily ultimately a subjective assessment, not a mathematical one. > Compilation of call-conventions, memory layout and memory allocation interfaces can be done at scale with type systems Sure, but not because type systems represent a deep mathematical truth, but rather because they constrain the programmer to write code that is easier to compile because it is amenable to certain kinds of partial evaluation. It's kind of like how the existence of roads makes it easier to design certain kinds of cars, and these cars all share certain design features, and this leads to certain significant economic benefits. It does not follow that there is no value in designing vehicles that don't need roads.