3 ms·
This is one of the pros of using a strictly typed language: there errors like these can only go unnoticed if the other object has the same type. And in language
by atoav 7y ago
This is one of the pros of using a strictly typed language: there errors like these can only go unnoticed if the other object has the same type. And in languages like Rust with a concept of ownership even those might be cought in compilation..
Naming things is hard. But it is a lot easier if you can rely on it not breaking things all the time.
- Pxtl 7y agoHashtables full of record-like objects are the usual problem. I often find myself throwing records into a hashtable and then keying it by one of its properties, and that means it's a simple primitive and there may be many of the same type. If I've a record with a half-dozen int properties that are semantically IDs, I have to clarify which is the key for this hashtable.