Permalink
Fetching contributors…
Cannot retrieve contributors at this time
136 lines (80 sloc) 2.62 KB

TITLE

DRAFT: Synopsis 32: Setting Library - Callable

VERSION

Created: 26 Feb 2009

Last Modified: 5 Nov 2013
Version: 3

The document is a draft.

This document documents Code, Block, Signature, Capture, Routine, Sub, Method, Submethod, and Macro.

Callable

role Callable {...}

The Callable role implies the ability to support postcircumfix:<( )>.

Code

class Code does Callable {...}

Base class for all executable objects.

signature
method signature( --> Signature )
assuming
method assuming( Code $executable: *@curried_positionals, *%curried_named --> Code)

assuming primes $executable, returning a Code object that, when executed, will use curried arguments as well as any additionally supplied arguments. See "Priming" in S06.

defined
method defined( --> Bool )

For Code, the .defined method returns whether a body has been defined. A body consisting only of ..., !!!, or ??? (with optional message arguments) does not count as defined.

To test if a name has been declared, look up the symbol in the appropriate symbol table.

Block

# Executable objects that have lexical scopes
class Block is Code does Callable {
    method next()   {...}
    method last()   {...}
    method redo()   {...}
    method leave()  {...}
    method labels() {...}
    method as()     {...} # See L<S12/Introspection> and L<S02/Value types>
}

Signature

class Signature {...}

The Signature class is used for function parameters, as the left-hand side of a binding, and for the argument to declarators like my. See "Signature objects" in S02, "Signatures" in S06, and "Signature Introspection" in S06

Capture

class Capture does Positional does Associative {...}

The Capture class is used for the arguments of function calls and the right-hand side of a binding. See "Lists, parameters, and Captures" in S02

WrapHandle

class WrapHandle {...}

Routine

class Routine is Block {
     method wrap(Code $code --> WrapHandle ) {...}
     method unwrap(Wraphandle $original --> Routine ) {...}
     method name( --> Str ) {...}
     method multi( --> Bool ) {...}
}
unwrap

See "Wrapping" in S06.

wrap
method wrap(Code $code) {...}

See "Wrapping" in S06.

Sub

class Sub is Routine {...}

Method

class Method is Routine {...}

Submethod

class Submethod is Routine {...}

Macro

class Macro is Routine {...}

AUTHORS

Tim Nelson <wayland@wayland.id.au>
Larry Wall <larry@wall.org>