‹ BackHN Continuity

Thread

Vx – One Language, Every Chip

75 points · 54 comments · elffjs

  1. AnimalMuppet · · focus · HN ↗
    I haven't played with it at all, but the writeup looks promising. Moving a bunch of things into the type system and out of runtime crashes is one of the ways we make progress.
    1. dnautics · · focus · HN ↗
      I think this is wrong. Type systems should be simpler, and you should design it so that your language is easily and correctly statically checked. Not all invariants necessarily have to be verified at the same cadence (compile time)
      1. treyd · · focus · HN ↗
        > you should design it so that your language is easily and correctly statically checked.

        You do that by making the type system more sophisticated.

        If you have a really important invariant that you really don't want to be violated due to run-time behavior/input, it's a huge benefit to have a compiler that can statically check that it actually can't be. That's one of the main benefits of having type systems, not just describing the shape of data structures in memory.

        1. dnautics · · focus · HN ↗
          You can perform static analysis outside of the compiler without putting things in the type system?

          C is a bad language to do this with for various reasons, but as a simple example:

              char* buf = malloc(SIZE);
              free(buf);
              free(buf);
          
          There is absolutely no reason why static analysis should not be able to see what the problem is here.
          1. imtringued · · focus · HN ↗
            ok but what if you call

            buf_create(SIZE)

            and

            buf_destroy(buf)

            now the compiler has to infer that buf_create creates a lifetime and buf_destroy destroys it.

            we're back to Rust's Box.

            1. dnautics · · focus · HN ↗
              Congratulations, you have hit upon one of the reasons why c is a bad choice. Other languages make this easier.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.