Ignore:
Timestamp:
Sep 23, 2021, 3:36:04 PM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
9411cf0
Parents:
75c7252
Message:

Andrew MMath: Updated thesis with Yizhou Zhang's feedback.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/andrew_beach_MMath/intro.tex

    r75c7252 r814f87d  
    220220unwinding the stack like in termination exception
    221221handling.\cite{RustPanicMacro}\cite{RustPanicModule}
    222 Go's panic through is very similar to a termination, except it only supports
     222Go's panic though is very similar to a termination, except it only supports
    223223a catch-all by calling \code{Go}{recover()}, simplifying the interface at
    224224the cost of flexibility.\cite{Go:2021}
     
    265265This pattern is very popular in any functional or semi-functional language
    266266with primitive support for tagged unions (or algebraic data types).
    267 % We need listing Rust/rust to format code snippets from it.
    268 % Rust's \code{rust}{Result<T, E>}
     267Return unions can also be expressed as monads (evaluation in a context)
     268and often are in languages with special syntax for monadic evaluation,
     269such as Haskell's \code{haskell}{do} blocks.
     270
    269271The main advantage is that an arbitrary object can be used to represent an
    270272error, so it can include a lot more information than a simple error code.
     
    272274execution, and if there aren't primitive tagged unions proper, usage can be
    273275hard to enforce.
     276% We need listing Rust/rust to format code snippets from it.
     277% Rust's \code{rust}{Result<T, E>}
     278
     279Return unions as monads will result in the same code, but can hide most
     280of the work to propagate errors in simple cases. The code to actually handle
     281the errors, or to interact with other monads (a common case in these
     282languages) still has to be written by hand.
    274283
    275284\item\emph{Handler Functions}:
Note: See TracChangeset for help on using the changeset viewer.