News for hackers. Stuff that matters.
Re:The type system is a programmer's best friend by sixstringtheory on Saturday November 05, 2022 @05:06PM (#33485743)
I can see how it could cause problems if they weren’t using the type system correctly.

    typedef float cm;
    typedef float meter:
    cm a = 1;
    meter b = 1;
    if (a == b) {
        // launch rockets
    }
I’ve done something similar (not including rockets, don’t worry!) in Swift with its typealias feature. Thankfully there is a way to actually force compiler errors in such situations with something like https://github.com/pointfreeco/swift-tagged

There are no comments on this comment yet.