Week 12 Flashcards
(13 cards)
What is the future of programming?
You are unlikely to program in a purely functional language
However, you are likely already using functional programming principles due to their increasing adoption in mainstream programming languages
What is industrial inertia, and how does it affect new programming languages?
Industrial Inertia: Resistance to adopting new programming paradigms due to existing investments in old technologies
New programming languages often resemble old ones (e.g., “horseless carriages”) to ease adoption
What are higher-order functions?
Higher-order functions are functions that take other functions as arguments or return them as results.
What are polymorphic types, and how are they used?
Polymorphic Types: Allow functions to operate on arguments of various types while maintaining type safety.
What is the Verse programming language, and what is it used for?
Verse: A language for the Unreal Editor for Fortnite (UEFN) to control the behavior of assets in a gaming metaverse
Released by Epic Games, it supports custom game modes and scales well for thousands of players
What are the key features of Verse?
1.Multi-paradigm
2.Strongly typed
3.Expression-oriented
4.Failure is control flow
5.Concurrency
6.Speculative execution
What does it mean for Verse to be multi-paradigm?
Verse combines functional, logic, object-oriented, and imperative programming paradigms
Values are immutable by default, ensuring consistent results for the same code and data
Example:
AnswerToTheQuestion : int = 42
What does strongly typed mean in Verse?
Strongly Typed: Every identifier has a specific type, minimizing uncaught errors
Predictable results because types and operations are predefined
Example:
WinningPlayer : int = 100
Announcement : string = “… And the winner is: {WinningPlayer}!”
What does it mean for Verse to be expression-oriented?
There is no distinction between statements and expressions; everything is an expression
The result of the last expression in a function is the function’s return value
Example:
AreaOfCircle(Radius : Float) : Float = Pi * Radius ** 2
How does Verse handle failure?
Control flow changes based on whether an expression succeeds or fails
Example:
if (Score := Scores[High]):
Log(Score)
What is concurrency in Verse?
Concurrency is built into the language
Race expressions run multiple
asynchronous blocks simultaneously, with the first to complete being used
Example:
set WinnerResult = race:
AsyncFunctionLongTime()
AsyncFunctionShortTime()
AsyncFunctionMediumTime()
What is speculative execution in Verse?
Speculative Execution:
Effects are committed if an expression succeeds
Effects are rolled back if it fails
Implemented using Software Transactional Memory (STM). Reads and writes are logged and only committed if there are no conflicts