Skip to main content

crashtest.hxsmith.features.closures

Function values: local functions, lambdas, captured and mutated variables, higher-order helpers, bind.

Function-typed values can never refer to themselves: a lambda body does not see mutable function variables (a later assignment could point one back at its caller) and function parameters are frozen.

class Closures(Feature)​

name​

name = 'closures'

summary​

summary = 'local functions, lambdas, captured variables, higher-order helpers, bind, IIFE'

covers​

covers = ('EFunction', 'FKAnonymous', 'FKNamed', 'FKArrow', 'ECall', 'ETernary', 'EFor', 'EWhile', 'EArrayDecl')

requires​

requires = ('variables', 'functions')

order​

order = 45

declare​

def declare(g: Gen) -> None

types​

def types(g: Gen, depth: int)

show​

def show(g: Gen, ty: Ty, expr: str)

exprs​

def exprs(g: Gen, ty: Ty)

stmts​

def stmts(g: Gen)