class

Myst::AnonymousFunction

Inherits Myst::Node / Reference / Object

A shorthand function definition with multiple clauses. AnonymousFunctions are most commonly used to define complex behavior in place of a block parameter for a function. Clauses are defined using a "stab" (->), followed by a parenthesized parameter list, then a clause body wrapped like a normal block (either with {...} or do...end).

An anonymous function must be given at least one clause to be valid.

'fn' [ '->' '(' [ param [ ',' param ]* ]? ')' [ '{' | 'do' ] body [ '}' | 'end' ] ]+ 'end'

Constructors

new(clauses : Array(Myst::Block) = [] of Block, internal_name : String = "anonymous function")
Source

Instance methods

==(other : self)

Returns true if this reference is the same as other. Invokes same?.

accept_children(visitor)
Source
clauses
Source
clauses=(clauses : Array(Block))
Source
hash(hasher)

See Object#hash(hasher)

internal_name

internal_name is used as the name of the function for use in stack traces and other reporting mechanisms. This should not be used for any other public functionality.

Source
internal_name=(internal_name : String)

internal_name is used as the name of the function for use in stack traces and other reporting mechanisms. This should not be used for any other public functionality.

Source