Re:Why Structure and Interpretation of Computer Programs Mat...
by dataflow on Monday June 17, 2024 @02:17AM
(#40702795)
Not really. Whether an integer represents a width or a height won't even exist in your head if you're implementing a function like max(a, b).
[ Parent
| on HN ]
Re:Why Structure and Interpretation of Computer Programs Mat...
by chii on Monday June 17, 2024 @03:35AM
(#40703139)
> exist in your head if you're implementing a function like max(a, b)
surely, you have an idea of what you're using that function for, while you're writing it.
The compiler is doing a check to see if the function makes some minimal logical sense (ala, a typecheck), but it cannot read your mind. But this implies the types are actually an actualization of the thoughts in your head, in a formal manner.
Re:Why Structure and Interpretation of Computer Programs Mat...
by lomase on Monday June 17, 2024 @03:36AM
(#40703144)
The type is encoded in the name of the function.
Is a pretty bad system because you say "won't even exist in your head" but I dont even know if I should pass it integers, floats a srtring. Or what it will return.
Re:Why Structure and Interpretation of Computer Programs Mat...
by globular-toast on Monday June 17, 2024 @03:34AM
(#40703132)
Because inside the abstraction max it doesn't represent a width or height, they are just numbers (or just some "comparable things"). But outside the abstraction, at some level, you'll definitely know what a and b are.