• thenextguy@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    22 days ago

    I don’t see it. I would much prefer to validate early rather than late. The example of ‘other code might validate it differently or not at all’ seems specious. I don’t want invalid information “deep within the bowels of the system”.

    • esa@discuss.tchncs.deOP
      link
      fedilink
      arrow-up
      1
      ·
      22 days ago

      Parsing is a way of “validating early”. You either get a successful parse and the program continues working on known-good data with that knowledge encoded in the type system, or you handle incorrect data as soon as it’s encountered.