Skip to content

Clarify evaluation semantics of shared terms #633

@jfeser

Description

@jfeser

We've started to think about alternative evaluation strategies (e.g. #594) that take advantage of sharing in terms to avoid redundant work. As part of this work, we should clarify and document the semantics of effectful programs.

We should respect the following equation:

handler(i)(evaluate)(p()) == handler(i)(p)()  # delaying evaluation preserves semantics

Consider a program with two effects f and g:

def p():
  x = f()
  y = g(x, x)
  return y

Our current implementation of evaluate respects this equation only when i is pure, because f is handled twice on the LHS and once on the RHS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions