• 15 Posts
  • 250 Comments
Joined 2 years ago
cake
Cake day: June 2nd, 2024

help-circle
  • The “bypasses” your first link talks about are mostly ways of telling the compiler about types. If I make an HTTP request, how is TypeScript supposed to know of the return type of some arbitrary API? That’s where as Foo comes in. If that makes a language not type safe to you, then you must also throw out the types in Java’s variable declarations.

    Quite a few more of these ‘bypasses’ fall into the category ‘garbage in, garbage out’. If you declare a string index on an object that does not, in fact, return a value for every string passed, what do you expect the compiler to do about it? This is easily fixed by declaring the proper type Partial<{[key: string]: T]>.

    If you declare a variable as an Integer and then let the database driver write a Person reference into that variable, Java will fail in the same way.

    Some of these bypasses are just lies, like “delete operator - Remove required properties”. You cannot delete a mandatory property from a type.

    One thing I grant you that I was reminded of while reading that article is this: Some constructs are simply not expressible in TypeScript (that I know of). For instance, an object that serializes to valid JSON. That could be used to introduce type-unsafety (or whatever the correct term is).

    From your second link:

    TypeScript is indeed type-safe

    Thanks for disproving yourself, I guess.

    The medium article contains good examples, if a bit contrived. Thanks for digging that up.










  • bleistift2@sopuli.xyztoProgrammer Humor@programming.dev;DR blame the dev
    link
    fedilink
    English
    arrow-up
    59
    arrow-down
    4
    ·
    edit-2
    5 days ago

    I agree with the post. Setting up typescript takes an hour or two if you have no clue what you’re doing. In return you get the absence of (the equivalent of) null pointer exceptions.

    I chuckle every time I find an NPE in the Java backend. Doesn’t happen to me. Can’t happen to me.

    Sidenote, while I’m already gloating: Once the backend code had an error where they were comparing two different kinds of IDs (think, user ID and SSN), which gave wrong results. This error can’t happen to me either, because I type my IDs such that they are not comparable. A strong type system really is a godsend.


  • At my company we use M-Files, which is a document storage system that prides itself in not using folders. “No more searching for the file in thousands of folders”, they proclaim. It’s all a huge dump of files. To find files you need to tag them when checking them in. Later you search via these tags.

    Guess what happens: All documents are either untagged or they’re tagged with wildly unhelpful tags. So in reality you can’t find shit. You can’t even make a sensible guess as to where a file might be and check the 3–5 folders that come to mind, because there are no folders.

    M-Files is a black hole for information. No, scratch that. Even black holes radiate out the information they receive. M-Files doesn’t.




  • The driver needs to interface with the OS kernel which does change, so the driver needs updates.

    That’s a false implication. The OS just needs to keep the interface to the kernel stable, just like it has to with every other piece of hardware or software. You don’t just double the current you send over USB and expect cable manufacturers to adapt. As the consumer of the API (which the driver is from the kernel’s point of view) you deal with what you get and don’t make demands to the API provider.