1. 33
  1. 16

    A Rust programmer may think of longer_of as a function that borrows its arguments mutably and returns a mutable reference bound by the lifetime of those arguments. What happens is semantically identical, but notice that in Val, longer_of has no lifetime annotations. Lifetime annotations were not elided, they simply do not exist in Val because the it uses a simpler model, devoid of references.

    It is natural to be skeptical, I was too. If you need an endorsement, Graydon Hoare, who created Rust, opined:

    Feels close to the sweet spot of comprehensible ownership semantics I often daydream about having kept Rust at.

    I feel the same way.

    1. 2

      Is the main loss, relative to Rust, that you can no longer produce data structures containing references? For example, not being able to make a vector of references to substrings within a larger string:

      fn split_on_whitespace(string: &str) -> Vec<&str> { ... }

      Where some important properties about this function are that it’s guaranteed not to copy any part of the string, and the caller retains immutable access to the whole string even as they have access to the substrings.

      I’m guessing the Vale/Swift answer is to change this function to return Vec<(index, index)>?

    2. 9

      So many new languages I can’t keep them straight … we’ve got Vale, V, and now Val.

      Especially confusing since one of these is fairly controversial with a fair number of claims that it doesn’t do what it promises.

      1. 12

        There is also Vala. V-L space is kind of crowded.

        1. 2

          Ah yes, when I read the title of this post I immediately confused it with V/Vlang …

          1. 2

            This one is based on VALue semantics. That will help me remember.

          2. 6

            The Golden Age of PL Research is right!

            I read through this language description and thought, “this sounds like Swift.” Then I opened up the paper about “mutable value semantics,” and it looks like Swift is a major direct inspiration for this language. That’s great! Swift’s value semantics are fantastic. It sounds like they’re just doubling down on that model of programming and not even introducing references.

            I’m into that.

            1. 6

              Not to be confused with the Vale programming language.

              1. 3

                How do collections work in this paradigm? Is there a Vec impl somewhere which I can take a look at?

                1. 4

                  Array appears to be the equivalent of a Vec in Rust, this is the code: https://github.com/val-lang/proto-stdlib/blob/main/Array.val