3 ms·
> Function signatures are for HUMANS to read Nope, exactly the other way around. Function signatures are to help machines optimize your code. What humans shoul
by Barrin92 2y ago
> Function signatures are for HUMANS to read
Nope, exactly the other way around. Function signatures are to help machines optimize your code. What humans should care about are names. It's just that we've normalized an extremely misguided practice of abusing type systems as a crutch for non-descriptive variable and function names.
- itishappy 2y agoHard disagree. It's a contract between compiler and coder, and it needs to be exposed to both. Type information does not belong in names. // For example, this: fn get_driving_requirements(vehicle: Vehicle) -> String { ... } // Is just so much nicer than this: fn get_driving_requirement_description_from_vehicle(vehicle) { ... } This is nicer for me (a human) to read, even if the compiler can infer the types of both.
- mrkeen 2y ago> It's just that we've normalized an extremely misguided practice of abusing type systems as a crutch for non-descriptive variable and function names. And maybe we just abuse formal logic because we've forgotten how to write good prose.