27 ms·
Static types are a partial application/reduction when certain mutable or unknown variables become constants (i.e. "I for sure only need integers between 0-255 h
by 3cats-in-a-coat 3y ago
Static types are a partial application/reduction when certain mutable or unknown variables become constants (i.e. "I for sure only need integers between 0-255 here").
I'm not rejecting static types entirely, and yes I was discussing exchanging data here, as Alan Kay's OOP is inherently distributed. It's much closer to Erlang than it is to Java.
- insanitybit 3y ago> I'm not rejecting static types entirely, and yes I was discussing exchanging data here OK I guess I'm having a hard time reconciling that with: > basically all static typing
- 3cats-in-a-coat 3y agoSorry, I see how I'm vague. The idea is you have no "pre-burned" static types, but dynamic types. And static types then become a disposable optimization compiled out of more dynamic code, in the same way JIT works in V8 and JVM for example (where type specialization is in fact part of the optimization strategy).
- insanitybit 3y agoYou're describing dynamic types
- 3cats-in-a-coat 3y agoBut with the benefit of static types, and without the drawbacks of static types.
- insanitybit 3y agoNo. "Types only known at runtime" are dynamic types. "And also you can optimize by examining the types at runtime" is just dynamic types. And it does not have the benefit of static types because it is dynamic types.
- 3cats-in-a-coat 3y agoThis is devolving into a "word definition war" so I'll leave aside what you call static types and dynamic types and get down to specifics. Type info is available in these flavors, relative to runtime: 1. Type info which is available before runtime, but not at runtime (compiled away). 2. Type info which is available at runtime, but not at compile time (input, statistics, etc.). 3. Type info which is available both at compile time and runtime (say like a Java class). When you have a JIT optimizer that can turn [3] and [2] into [1], there's no longer a reason to have [1], except if you're micro-optimizing embedded code for some device with 64kb RAM or whatever. We've carried through legacy practices, and we don't even question them, and try to push them way out of their league into large-scale distributed software. When I say we don't need [1], this doesn't mean I deny [3], which is still statically analyzable type information. It's static types, but without throwing away flexibility and data at runtime, that doesn't need to be thrown away.
- insanitybit 3y agoShort of time travel one can not turn (3) or (2) into (1). I'm not sure where the confusion here is or what you're advocating for because this isn't making sense to me. > there's no longer a reason to have [1] I guess if you're assuming the value of static types is just performance? But it's not, not by a long shot - hence 'mypy', a static typechecker that in no way impacts runtime. I think this conversation is a bit too confusing for me so I'm gonna respectfully walk away :)
- 3cats-in-a-coat 3y agoThe confusion is to assume "runtime" is statically defined. JIT generates code which omits type information that's determined not to be needed in the context of the compiled method/trace/class/module. That code still "runs" it's "runtime".
- insanitybit 3y agoYes, the types that JIT omits are dynamic types.
- cakoose 3y agoI'm not the person you're responding to, but I interpreted their comment as, "doesn't the argument against having protobuf check for required fields also apply to all of protobuf's other checks?" From the linked article the post: "The right answer is for applications to do validation as-needed in application-level code. If you want to detect when a client fails to set a particular field, give the field an invalid default value and then check for that value on the server. Low-level infrastructure that doesn’t care about message content should not validate it at all." (I agree that "static typing" isn't exactly the right term here. But protobuf dynamic validation allows the programmer to then rely on static types, vs having to dynamically check those properties with hand-written code, so I can see why someone might use that term.)