Live data from Hacker News

The Verse Programming Language [pdf]

simon.peytonjones.org

281–290 of 387 posts

Re: The Verse Programming Language [pdf]

#281
post #218

These slides need a lot of work. I'll read the paper later, but the slides really lack context and motivation. * I'm a little disheartened to see "Objectively: no. All languages are Turing-complete" in the context of the question of needing another language. It's a throw away comment and largely irrelevant when considering the actual use of programming languages. If one has to state this platitude, it is more accurat…

I see using the choice syntax as PROLOG-esque, rather than Python-esque. When you are building simple structures to iterate upon, it makes sense to use the more readable comprehension syntax, where you define a list or set of items and their desired properties. Yet this terse syntax makes more sense for logic programming, where a lot of the domain logic is built upon generate-and-test patterns; you define a combinato…

> I see using the choice syntax as PROLOG-esque, rather than Python-esque.

I didn’t think otherwise. Many functional languages have comprehension syntax, and I prefer declarative programming.

> When using this pattern, it's clearer to be able to express the space with the shortest syntax rather than the verbose one.

How is

    x 
or

    x 
more verbose than

    x := (1|2|3)
? Also, the first and especially second are basically identical to mathematical syntax, but the first implies order better.

Re: The Verse Programming Language [pdf]

#282
post #218

These slides need a lot of work. I'll read the paper later, but the slides really lack context and motivation. * I'm a little disheartened to see "Objectively: no. All languages are Turing-complete" in the context of the question of needing another language. It's a throw away comment and largely irrelevant when considering the actual use of programming languages. If one has to state this platitude, it is more accurat…

If you rename `fst` to `first`, then `snd` becomes `second`, which is much much (much!) longer.

Why does that matter though?

No writer does this. Why are programmers obsessed with word length to such a degree?

Re: The Verse Programming Language [pdf]

#283

It's cool to finally get some more details on this language. They showed some slides of it being used in Fortnite last year: https://mobile.twitter.com/saji8k/status/1339709691564179464... I believe it has roots in (but quite different from) Skookumscript https://skookumscript.com/about/look/

The code shown in those images is not in the programming language that is being introduced/created now by SPJ. It is clearly a separate (and not functional) scripting project.

https://nitter.lacontrevoie.fr/pic/orig/media%2FEpeZMhDUwAAY...

The screenshot says "BoxFight.verse". Either Unreal has two separate new programming languages both called Verse, or you're plain wrong.

Re: The Verse Programming Language [pdf]

#284
post #280

Earlier quoted context omitted.

It's definitely the most influential of the statically typed functional languages. All other statically typed functional languages or libraries inherit a lot from Haskell implementations, type system and type class concepts.

What modern language in use today was influenced by Haskell other than maybe Idris? (To be clear, I am mot necessarily down on Haskell or what part it has played. It’s just that many languages seem to be stealing ideas from the languages I’ve listed more than Haskell, which was the criteria I had in mind.)

Rust's traits come to mind as one example.

Re: The Verse Programming Language [pdf]

#285

It's cool to finally get some more details on this language. They showed some slides of it being used in Fortnite last year: https://mobile.twitter.com/saji8k/status/1339709691564179464... I believe it has roots in (but quite different from) Skookumscript https://skookumscript.com/about/look/

The code shown in those images is not in the programming language that is being introduced/created now by SPJ. It is clearly a separate (and not functional) scripting project.

I believe it is the same. Tim's Twitter has a lot of references to it:

https://mobile.twitter.com/TimSweeneyEpic/status/15955006213...

https://mobile.twitter.com/TimSweeneyEpic/status/16021821207...

You can find more information here: https://www.reddit.com/r/uefn/

I believe they've been using Fortnite as a testing ground for a while now, to hammer out the design.

Re: The Verse Programming Language [pdf]

#286
post #215

Earlier quoted context omitted.

Boolean values are inherently a sign of an insufficient data model. Booleans carry no inherent meaning. They don't tell you where they came from or provide any context about what operations or data they are guarding. If your language lets you declare your own algebraic data types, there's no need to lean on a built-in Boolean type. You can create types that actually carry all the information you need so that pattern…

> Boolean values are inherently a sign of an insufficient data model. Booleans carry no inherent meaning. Would you say the same about Ints or Strings?

Practical language-agnostic example: a database for a business where some VARCHAR(34) columns are IBAN codes and others are messages to be displayed on a 2 by 17 characters LCD screen.

They are two completely different data types that happen to have identical approximate representations but should be distinguished very strictly in a sufficiently expressive model.

For instance, it should be possible to turn an IBAN into a device screen message but not the opposite, but you can't do it if they are all "strings"; and the two types have different value constraints while a generic VARCHAR has none.

Re: The Verse Programming Language [pdf]

#287
post #220

Earlier quoted context omitted.

> Perhaps Verse will one day be as influential for PL design as Haskell has been. Has Haskell really been that influential though? It seems to me that MLs, Lisps, Schemes, and even Erlang have been more influential.

It's definitely the most influential of the statically typed functional languages. All other statically typed functional languages or libraries inherit a lot from Haskell implementations, type system and type class concepts.

It's influential but the most is stretching it.

It showed that monads can be used to isolate I/O but have a very real cost when it comes to complexity, that laziness by default is a bad idea and that typeclasses are a good way to introduce ad hoc polymorphism.

Definitely a good result for a research language but far less ground-breaking than ML was (admittedly putting the bar very high).

Re: The Verse Programming Language [pdf]

#288
post #284
post #280

Earlier quoted context omitted.

What modern language in use today was influenced by Haskell other than maybe Idris? (To be clear, I am mot necessarily down on Haskell or what part it has played. It’s just that many languages seem to be stealing ideas from the languages I’ve listed more than Haskell, which was the criteria I had in mind.)

Rust's traits come to mind as one example.

As far as I can tell, from an admittedly short amount of searching and research, is that type classes in Haskell were influenced by Standard ML: https://people.csail.mit.edu/dnj/teaching/6898/papers/wadler...

> This paper presents type classes, a new approach to ad-hoc polymorphism. Type classes permit overloading of arithmetic operators such as multiplication, and generalise the "eqtype variables" of Standard ML. Type classes extend the Hindley/Milner polymorphic type system ...

And it was my understanding that traits came more from the object-oriented world, such as Self and Smalltalk. Scala and Racket also had them before Rust, and Scala also has type classes.

Re: The Verse Programming Language [pdf]

#289
post #233

Very intriguing! Is there an explanation anywhere of how this is different from Prolog? It seems like almost the same thing. That is not a criticism BTW, I love Prolog. From what I can tell the main difference is it has functions with return values. It also looks like it has different semantics for the choice points, letting you nest alternatives in arguments and other expressions. I do like how choice points are see…

This definitely isn't Prolog, but in some ways it seems to be closer to Prolog than some other things.

One thing you can do in Prolog is build partial data structures: `X = tree(Left, Right)` builds a tree node with two "holes" `Left` and `Right` that you can fill in later -- or, crucially, might choose not to fill in. You can pass this "partial" data structure around, and other parts of the program may or may not instantiate it further. This allows some nice programming tricks. It allows proper tail calls in cases where functional programming doesn't allow tail calls, or only with heroic help from the compiler. It allows you to decompose your program in different ways from languages where you must always build data structures "inside out".

In contrast, Mercury is a syntactically Prolog-like language that doesn't allow this: (AFAIK) when you pass a term to a predicate, it must either be ground, i.e., without any leftover "holes", or a variable, i.e., completely uninstantiated. This throws away much of the power and convenience of Prolog. And any language that takes a pure "Prolog's logic variables are just sequence generators" approach must also fall into this category.

Verse seems to be more lenient in the "it's all just sequences" department. You can pass uninstantiated stuff into functions and have it further instantiated in there. It's not clear to me to what extent this works, there are no examples with data structures in the slides and I haven't gone through the paper yet. I can well imagine this being closer to Prolog than to Mercury. But the "Everything is eventually evaluated" is definitely not fully Prolog-like; Prolog doesn't care about everything eventually being ground. There is no need for that.

On a related note, even though it's popular to say that Prolog can "run code backwards", that is in fact not the case at all. Prolog always runs your code forwards. If your code is designed accordingly, you can often treat an argument `X` as an input and an argument `Y` as an output, and also have a use case of the same code where `Y` is an input and `X` is an output. But the code itself always runs in a well-defined top-to-bottom, left-to-right way. This is notably different in Mercury, where the compiler will explicitly compile different versions of your code for different use cases, reordering things so that sometimes you are actually running bottom-to-top when compared with the source code order.

Evaluation order in Verse is... all over the place. I suspect this will be problematic in practice. If you understand how Prolog evaluates your code, you can work with it to write performant code. Verse seems to be too flexible in this regard, so that it will be difficult to impossible to understand what is actually going on in what order. If you treat all your values as generators that can start enumerating stuff at any point, it will be very easy to have cases of combinatorial explosion by choosing wrong orderings. I see that there are some notes on this in the paper, but not much more than "some things are obviously not what we want, but we don't know what exactly we want". So let's see what happens, but for now this doesn't seem to want to be close to Prolog.

Final syntactic notes: Mercury has the Prolog-like predicate syntax that as noted can run "backwards". It also has a functional syntax where (AFAIK) it's not possible to run "backwards". This seems to be the right choice to me. You can mix and match predicates and functions to build what you want and retain clarity. Using a function syntax for things that can run "backwards" will be cute but confusing. Relations should be written as relations IMHO.

As for micro-syntax, others have complained about `fst` and `snd`, and I also tend to think that we can afford a few more bytes. But my main complaint is with `false?`. If in the slides introducing your syntax you feel compelled to call something "quirky", that's a clear indication that it should change. It's such a weird name. Why the question mark? Why does the name evoke booleans if the language has no booleans and discourages boolean thinking? If I'm supposed to think in terms of sequences, a better way for a sequence that contains nothing would be `none`. If I'm supposed to think in terms of logic variables, a better name for a logic variable that is bound to no value is... also `none`. The name `false` is just such a surprisingly bad fit.

This is something to watch, it's an interesting point in the design space. It might end up as something that (finally) is better than Prolog. It won't end up as being "almost the same thing" though, I don't think.

Re: The Verse Programming Language [pdf]

#290
post #281

Earlier quoted context omitted.

I see using the choice syntax as PROLOG-esque, rather than Python-esque. When you are building simple structures to iterate upon, it makes sense to use the more readable comprehension syntax, where you define a list or set of items and their desired properties. Yet this terse syntax makes more sense for logic programming, where a lot of the domain logic is built upon generate-and-test patterns; you define a combinato…

> I see using the choice syntax as PROLOG-esque, rather than Python-esque. I didn’t think otherwise. Many functional languages have comprehension syntax, and I prefer declarative programming. > When using this pattern, it's clearer to be able to express the space with the shortest syntax rather than the verbose one. How is x or x more verbose than x := (1|2|3) ? Also, the first and especially second are basically ide…

True, those are not more verbose, but are merely list enumerations, not comprehension, which bundles multiple generators and tests within the same structure, e.g.:

[(x, y) for x in [1, 3, 5] for y in [2, 7, 8] if x It's a single monolithic expression that builds the list. The choice syntax however represents each generator and each test as separate expressions, which may even be part of different functions. This seems to offer more flexibility. For example (I don't know the exact syntax):

x:=(1|2); y:=(7|8); xHere result is bound to the same values as in the comprehensive list; but these values are yield one at a time, instead of being part of a structure that you traverse.

Post reply on HN