[HN Gopher] Beyond Functional Programming: The Verse Programming...
___________________________________________________________________
Beyond Functional Programming: The Verse Programming Language [pdf]
Author : WillPostForFood
Score : 141 points
Date : 2022-12-11 20:08 UTC (2 hours ago)
(HTM) web link (simon.peytonjones.org)
(TXT) w3m dump (simon.peytonjones.org)
| Smaug123 wrote:
| This language is cyuuuute! The multi-valuedness making "if (x |
| y) then..." work is so neat, and having `x : int` be a thing of
| exactly the same nature as `x = 3` is cool to see; even in a
| fully dependently-typed language, those things are not of the
| same kind. This looks super mind-expanding to try out!
|
| (My first reaction is some slight aversion to what the "flexible"
| and "rigid" stuff is doing in the conditional scrutinee body, but
| maybe that'll feel natural after playing with the formal
| specification a bit.)
| davidw wrote:
| I'm not sure about the "learn it as a first language" bit.
| x:=(1|2); y:=(7|8); (x,y)
|
| This stuff just doesn't seem intuitive to me. It's not verbose
| enough to be obvious to someone who doesn't know what's going on.
|
| Looks interesting though; that's a really bright group of people.
| Be curious to see where their project ends up.
| tinco wrote:
| I'll be the first to hate on C++, but the only reason C++ might
| be considered a "don't learn it as a first language" language,
| is because it's huge. It's got 40 years worth of baggage, and
| it's "standard" libraries are an absolute mess. Javascript has
| a super simple syntax, and it's standard libraries though
| sometimes a bit idiosyncratic are comparatively clean and
| pragmatic.
|
| If you just removed like 90% of C++'s useless standard library,
| and restricted the syntax to purely what's in Strousup's "Tour
| of C++" book, then I'm pretty sure that would be a pretty
| acceptable "learn it as a first language" language. Of course
| in that imaginary world C++ would also not have been deprecated
| by Rust.
| sicp-enjoyer wrote:
| > 90% of C++'s useless standard library,
|
| The Python library is even larger and doesn't seem to be a
| barrier. If you know `std::vector`, `<<`, and `std::sort` it
| seems you're set to contribute to most code bases.
|
| > C++ would also not have been deprecated by Rust.
|
| That's an overstatement, to say the least.
| qayxc wrote:
| > I'm not sure about the "learn it as a first language" bit.
|
| I think this is very subjective. Our minds have been "poisoned"
| - or rather trained over years - into a very specific way of
| thinking about expressions like in the example.
|
| A first programming language, however, assumes that learner
| hasn't been preconditioned in any way into a certain paradigm.
| So just keeping the two rules in mind that 1) evaluation is
| strictly from left to right and 2) an expression evaluates to a
| sequence of zero or more values immediately makes sense of the
| example.
|
| Unfortunately it's incredibly hard to "reset" your mind into a
| state that doesn't know about variable assignments and thinking
| of variables as singular slots as is the case in Haskell and
| most other programming languages.
|
| That's why "intuition" is a very subjective thing - your
| intuition changes with knowledge and experience and both are
| hard to suppress.
| yzsh wrote:
| This looks like Erlang for game design.
|
| I've done some game programming software and a large number of
| their decisions make sense in that environment. In particular,
| expression evaluation and a lack of booleans.
| chrisbaker98 wrote:
| I have no experience with game programming. Why would you not
| want booleans when developing games?
| davedx wrote:
| I mean it's either genius, madness, or both.
|
| Most programming languages I can least understand the general
| gist, the core motivation, whatever.
|
| I have a lot of respect for Epic Games so I read through most of
| it but I have to say I'm still non the wiser.
|
| If forced to summarize I'd say.. it's some kind of Haskell-ish
| language where the types themselves are defined by ... runtime
| functions? With some attempt at also being a prolog-ish logic
| language?
|
| But why?
| lambdatronics wrote:
| Yeah. Super interesting concepts I hadn't come across before,
| but it's hard to see the motivation for the design choices, in
| light of the stated goal (which is itself a bit 'out there').
| OTOH, it's in general a hard problem to predict the emergent
| characteristics of the ecosystem of a programming language just
| from the underlying design choices.
| thelazydogsback wrote:
| Some of this reminds of me a combination Icon and Mozart. (And
| happened to just come across my old Icon book a few days ago.)
|
| Maybe the backtracking concepts are "too built in?" - e.g., (1|2)
| is not a first-class/reified "amb" object, right? - so if I want
| to introduce a different search than depth-first backtracking
| (breadth, dependency-directed), etc., I couldn't directly.
|
| Seems like there could be some confusion between multiple,
| backtracked values and actual sequences -- this often leads to
| sub-optimal/confusing Prolog code as well, deciding when you have
| an explicit control structure vs. backtrack, when to "harden"
| results using setOf/bagOf/findAll, etc.
| st3fan wrote:
| This looks like a language designed for language designers and
| not for language users.
| typon wrote:
| This is sadly the problem with most new languages.
| julik wrote:
| I know people will throw stones, but dynamic-oop-folks likely
| remember https://en.wikipedia.org/wiki/Croquet_OS
| phtrivier wrote:
| I honestly fail to see what properties of the language has
| anything to do with the metaverse, or millions of devs, etc...
|
| At first I though the "choice" construct would be a way to
| distribute code execution among multiple computers (using the
| fact that in a grandiose metaverse, everything would be a
| connected computer with lots of compute time to spare ?) but
| there is not much detail.
|
| Also it's not obvious from the slide if there is already a
| compiler / execution env at the moment, or how far they are from
| it.
|
| Now, the names behind this aren't exactly bozos, so I suppose
| we'll get to know soon.
|
| Wait and see, I guess ?
| Avshalom wrote:
| I mean logic languages have a history of... trying to be
| distributed but it's never really worked out.
| qayxc wrote:
| My guess would be that it's the usual case of trying to solve
| a non-technical issue by throwing new technology at it.
|
| I honestly cannot wrap my head around how a programming
| language of all things should solve the "millions of
| programmers working on a thing"-issue.
| pizza wrote:
| I guess I sort of see where it's coming from - the context is
| that hundreds of devs have to write code that has to
| preemptively cooperate with other code. So I think the lenient
| evaluation might be key for this.
|
| Suppose you wander into a new environment, it contains some
| object x, and it has some capability f(x). Suppose your avatar
| or whatever has some code that already integrates with this
| f(x). You could just call f(x) in advance, and once you enter
| that environment, it lazily executes f(x). Or maybe I'm way off
| base here.
| WillPostForFood wrote:
| _Also it 's not obvious from the slide if there is already a
| compiler / execution env at the moment, or how far they are
| from it._
|
| It is expected to release in January as part of Fortnight
| Creative (delayed from this month).
| jasonhansel wrote:
| No offense, but: does this actually relate the metaverse, or was
| that part added in so Epic Games would fund it? I don't see any
| first-class features that would be specific to that use case.
| mncharity wrote:
| Verse reminds me of Mozart/Oz[1][2].
|
| I really liked Oz, and thought it had a lot of potential. But its
| documentation was a big adoption barrier (scattered mess plus
| expensive textbook), and Oz failed to escape being a turn-of-the-
| century European research and intro-CS language. The intro-CS
| role perhaps lends plausibility to Verse's "a first language"
| objective, despite the off-mainstream computation model. Explicit
| `amb` though.
|
| [1] https://en.wikipedia.org/wiki/Oz_(programming_language) [2]
| http://mozart2.org/mozart-v1/doc-1.4.0/tutorial/index.html
| leetrout wrote:
| Off topic but wow cannot believe someone used comic sans.
| dan-robertson wrote:
| He has used that PowerPoint style for years if not decades.
| kryptiskt wrote:
| He used it in the "Tackling the Awkward Squad" talk from
| 2001[0], so it's been a long time.
|
| [0] https://www.microsoft.com/en-
| us/research/publication/tacklin...
| Smaug123 wrote:
| It's just because SPJ likes it. He uses it for presentations a
| lot.
| tokamak-teapot wrote:
| I like it. It's easy to read.
| rowanG077 wrote:
| Why not? Comic sans is the most inclusive font.
| d_tr wrote:
| Fun fact: Comic Sans is supposed to be easier to read for
| dyslexic people.
| jasonhansel wrote:
| IIRC fonts specifically made for dyslexic people (e.g.
| OpenDyslexic) tend to be even better in that regard; if the
| goal is accessibility, one of those would be a better choice.
| hakanderyal wrote:
| That's a wise move from Epic.
|
| If we somehow happen to have a few competing metaverses, the one
| with the biggest developer mind share will likely come out ahead.
|
| Just reading the PDF energized me about the possibilities.
| WillPostForFood wrote:
| Text from the "10,000 Foot View" slide:
|
| --
|
| Verse is a functional logic language (like Curry or Mercury).
|
| Verse is a declarative language: a variable names a single value,
| not a cell whose value changes over time.
|
| Verse is lenient but not strict:
|
| Like strict:, everything gets evaluated in the end
|
| Like lazy: functions can be called before the argument has a
| value
|
| Verse has an unusual static type system: types are firstclass
| values.
|
| Verse has an effect system, rather than using monads.
| mncharity wrote:
| I'll add text from the "Take-aways" slide:
|
| --
|
| Verse is extremely ambitious
|
| Kick functional logic programming out the lab and into the
| mainstream
|
| Stretches from end users to professional developers
|
| Transactional memory at scale
|
| Very strong stability guarantees
|
| A radical new approach to types [me: predicate functions]
|
| Verse is open
|
| Open spec, open-source compiler, published papers (I hope!)
|
| Before long: a conversation to which you can contribute
| [deleted]
| pastrami_panda wrote:
| Reading half of it I'm struggling to see why they chose the
| semantic 'false?'. How do you read it? It sounds like a question,
| why not just 'false'?
| AstixAndBelix wrote:
| The metaverse is a collection of 3D environments just like web2
| is collection of documents.
|
| A webserver serves document while a metaverse server is basically
| a multiplayer videogame host.
|
| Your browser opens a metaverse site by downloading a game engine
| and running it through JS and fetches the resources from the
| server to load the 3D environments.
|
| All this to say: what has this functional programming language
| actually to do with the metaverse?
| AstixAndBelix wrote:
| ugh, so many downvotes and not a single person to explain why
| this is "a language for the metaverse" as opposed to being just
| "a new language"
| myrryr wrote:
| The short answer is Innate parallelism at a far higher degree
| than most languages.
|
| The longer answer is pure functions applied to immutable
| objects (or objects held in a transition) can be applied in
| parallel.
|
| The language is designed in a way to give you that, in a way
| where it is by default rather than in special cases.
|
| The second part is, it being at a mid point between lazy and
| not - things will be evaluated as there is processor to do
| so. So things which can be delayed will be, but if something
| can be done now, for later, it will be.
|
| The combo of this means you can handle more interactions with
| entities per second, using the cores available.
| grumpyprole wrote:
| Most mainstream programming languages are designed as if we
| are all targeting 70s von Neumann machines. When applying
| these languages to e.g. highly distributed or concurrent
| architectures, they are no longer a good fit. It's great to
| see at least an attempt at innovation rather than just a Java
| clone, which is all Google and Microsoft have ever offered so
| far.
| astrange wrote:
| I've never seen a program that would magically be better on
| a distributed architecture if it was written in a different
| language. Programs run on a single core because they have a
| single core's worth of work to do. Autoparallelization,
| like autovectorization, doesn't work.
| eddsh1994 wrote:
| I don't believe the metaverse will be a browser app; even
| Decentraland now pushes to a download because it has to do so
| many real-time operations.
|
| That said, I've worked with a few of the Haskell OG team (not
| directly SPJ though) and if you bring in a functional
| language designer to work on a project you can bet it'll
| start with a new language (I've worked on two domain specific
| languages due to this).
|
| Some of the constraints right now with this sort of program
| are CPU/GPU bound, so if we they're building a new I suspect
| it's going to focus on concurrency across threads/GPUs to
| support the high rendering requirements etc and make it
| easier to work with networking and C/C++ FFI GPU drivers.
| This is speculation on my part though :)
| WillPostForFood wrote:
| They are designing and creating Verse to be the scripting
| language for the Unreal engine, and the game Fortnight. So it
| is purpose built to drive 3d multiplayer worlds. It will be
| fun to see how it works out. I think it is cool to see a
| functional language around a game engine.
| charcircuit wrote:
| >Kick functional logic programming out the lab and into the
| mainstream
|
| Yet this presentation did none of that. There were no montivating
| examples on practical usage. The language does not map cleanly to
| webassembly, it instead reduces to a prolog like graph based
| execution model. In order to go mainstream you need to be solving
| more problems that existing languages have than you are creating
| by having someone use your new language.
| mncharity wrote:
| The TFA slides live on [1], along with the paper[2].
|
| [1] https://simon.peytonjones.org/verse-calculus/ [2]
| https://simon.peytonjones.org/assets/pdfs/verse-conf.pdf
| sweetsocks21 wrote:
| 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/
| tinco wrote:
| For those wondering if there's actually something relevant to the
| Epic's approach to the metaverse: there's not beyond slide 3.
| Everything after slide 3 is a description of the semantics of a
| novel functional logic programming language, the sort of which
| you'd expect you'd get if you paid the world's premier Haskell
| core contributor a large sum to design a new language. Of course
| its intended audience is Haskell programmers, so perhaps it would
| be weird to expect anything else.
|
| Slide 61 and 63 hint at things that might actually be of
| consequence to real programmers making real software for a
| potentially real metaverse, such as the effect system for I/O,
| transactional memory and code organisation through classes and
| inheritance, but it gives no detail.
|
| If you're interested how elegantly functions like head, tail,
| cons, snoc, append and map might be implemented, this
| presentation is for you. If you're more interested in how you
| might unpack a message from bytestring, model a state machine or
| coordinate a group of actors in a distributed system, then I
| guess you'll have to wait for the next presentation.
| benji-york wrote:
| I'm sure they know a lot more about language design than I do,
| but the use of what is essentially SQL's NULL for boolean false
| doesn't feel like a good idea at first blush.
| gliptic wrote:
| This looks a lot like a functional version of Icon
| https://en.wikipedia.org/wiki/Icon_(programming_language)
| giveexamples wrote:
| I dunno about slide 39 - where calling f(x) may or may not give x
| a value. From a code readability standpoint, a reader of the
| codebase needs to be wary of every function.
|
| I see the issue is that iff you explicitly marked it as inout, it
| would limit the code from a logic unification point of view. I
| guess this is already explored in prolog, which I have little
| experience with - but it feels like it would inherently limit the
| ability to scale a codebase to huge sizes. Maybe a combination of
| convention and naming would solve the problem.
| dan-robertson wrote:
| The metaverse angle doesn't make much sense to me but whatever.
|
| The big idea I see is that prolog-style backtracking logic
| becomes a first class notion in the language - every expression
| denotes a sequence of values reached through backtracking-like
| behaviour - which allows mixing logic-programming with a more
| familiar kind of functional programming. Though perhaps there are
| other ideas too.
|
| I think it will be interesting to see where this goes. Perhaps
| this will be another Fortress but SPJ is well regarded, has
| written a bunch of interesting papers, and has a bunch of
| experience managing a programming language project from haskell
| which will hopefully carry over.
| travisjungroth wrote:
| See slides 2 and 4. He has an idea of what a metaverse would
| look like and the technical challenges that will bring up. The
| language is meant to help solve them.
| Findecanor wrote:
| I'd think the real interesting stuff would have been the
| transactional parts and the effects system. Unfortunately,
| these slides don't describe them; they just mention that they
| exist.
| qayxc wrote:
| The paper also stops before going into these. These were
| the bits that actually interested me, but alas, guess we'll
| have to wait for that.
| dan-robertson wrote:
| Thanks. I re-read them but the metaverse angle still doesn't
| make much sense to me. I don't think that's super relevant to
| the PLT stuff though.
| travisjungroth wrote:
| I think it makes more sense if you don't think of it as an
| angle but a motivation. We've all been attacked with stuff
| like "shopping lists but on the blockchain!" for so long.
| This isn't like that. It's that they're foreseeing a
| technical problem of a shitload of concurrency and extra
| pain of API changes (metaverse) and this is meant to help.
| smcl wrote:
| > Like the metaverse vision, Verse itself is open
|
| Aren't these companies pursuing a "metaverse" product because
| they can lock it down, control it and make money on it? Otherwise
| rather than FB and Epic etc making their own, you'd have
| something developers could work with and use _right now_
|
| I wonder if maybe Simon Peyton-Jones has to play along with the
| whole metaverse fad just to do something he wants to do.
| charcircuit wrote:
| The strategy is more about getting a first mover's advantage.
| Companies believe the metaverse is inevitable and they believe
| that it will become a big part of the everyday person's life.
| These companies want to be key players in this space.
|
| Look at the open ecosystem of the web and think about how much
| money ICANN and Verisign make from their DNS. Anyone can make
| their own independent DNS (see projects like namecoin), but
| ICANN's has a big first mover's advantage that makes it hard to
| compete with them.
| smcl wrote:
| Oh I get it, but they're aiming for first-mover's advantage
| with the goal of being in control of something, not about
| implementing a lovely open ecosystem.
| ogogmad wrote:
| The choice stuff might make vector and GPU programming more
| natural, assuming it can be made efficient enough. The syntax it
| provides is certainly convenient for that. Might even be an
| advance over array programming in some ways, by being more
| flexible and opening up more forms of expression. Has this been
| considered?
| wayeq wrote:
| Every time someone gives a programming language a name that needs
| disambiguation terms for a decent google search, a puppy dies.
| crotho wrote:
| xwx wrote:
| These look like they might be the slides from SPJ's talk at
| Haskell eXchange this year.
|
| I'm hoping they'll upload a video soon, which'll probably be a
| lot more fun than slides. They've only got the recording up for
| one of this year's talks so far.
|
| https://skillsmatter.com/conferences/13688-haskell-exchange-...
| smcl wrote:
| Yeah Simon Peyton-Jones is quite good at talking, these slides
| are interesting but I think the full video will turn out to be
| much easier to digest
| AndrewPGameDev wrote:
| As a programming language - I mean it seems cool but it doesn't
| seem like much of an innovation when things like Granule, Idris,
| Unison, Erlang, and more already exist.
|
| I want to take a moment to look at the Metaverse angle. If there
| is going to be a unique programming language for the metaverse, I
| think it's not going to be textual but instead is going to
| primarily be a 3D language. This poses a big challenge for a VR
| language because _text is great[1]_. The point of making it 3D
| would be that you are somehow capable of transmitting more
| information via the higher-bandwidth channel of the human visual
| cortex than you are through text.
|
| If you aren't making a 3D programming language, well then it
| might be a cool programming language but I don't know what it has
| to do with the metaverse.
|
| [1] https://graydon2.dreamwidth.org/193447.html
| rileyphone wrote:
| Jaron Lanier developed a language in VR in the 80s much like
| you describe (apparently). Unfortunately, there is little
| evidence of it beyond some of his later testimony.
| rkrzr wrote:
| This looks incredibly ambitious:
|
| - There are no booleans in the language! Conditionals can still
| succeed or fail, but failure is defined as returning zero values
| and success is defined as returning one or more values.
|
| - Verse uses a so-called 'lenient' evaluation strategy which is
| neither strict nor lazy, but somewhere in-between ("Everything is
| eventually evaluated, but only when it is ready")
|
| - an expression does not evaluate to a value (like in Haskell),
| but instead to a sequence of zero or more values
|
| - tries to bring functional logic programming into the mainstream
|
| - Verse uses an effect system for I/O instead of monads
|
| - A type in Verse is "simply a function". E.g. int is the
| identity function on integers, and fails otherwise
|
| This all looks very mind-bending to me (in a good way). Perhaps
| Verse will one day be as influential for PL design as Haskell has
| been.
| stefano_c wrote:
| > - There are no booleans in the language! Conditionals can
| still succeed or fail, but failure is defined as returning zero
| values and success is defined as returning one or more values.
|
| This is similar to how Icon works:
| https://en.m.wikipedia.org/wiki/Icon_(programming_language)
| truculent wrote:
| Sounds like it's not a million miles away from how Clojure
| treats `nil` values, either
| tuukkah wrote:
| Or the List monad.
| fulltimeloser wrote:
| I guess someone will refrain using Verse
| 8f2ab37a-ed6c wrote:
| It's riveting to follow the evolution of Tim Sweeney's dream of a
| more Haskell-like programming language for games since his 2005
| talk: https://www.st.cs.uni-
| saarland.de/edu/seminare/2005/advanced...
| bibanez wrote:
| Very interesting slides. As someone not very acquainted with
| game programming it helped me better understand the logic
| behind it.
|
| As a sidenote, I found funny his predictions for 2009, because
| they're not far off from what we currently are aiming for: -
| 20+ cores - 80+ hardware threads - GPU's with general computing
| capabilities
___________________________________________________________________
(page generated 2022-12-11 23:00 UTC)