▲ | account42 4 days ago | |
Better yet would be unit-aware types. Then instead of duration_ms = 1000 you can have duration = 1s // or duration = Seconds(1) in deficient languages and it's either a compile error or the type system enforces the correct conversion. As for the bad rap of hungarian notation, it's mostly from people using it to encode something that is already clear from the types. "fDuration" helps no one over just "duration". | ||
▲ | 1718627440 2 days ago | parent [-] | |
But that's what the actual hungarian notation was about: decoding the type of thing it represents not the data type used. |