ERights Home elang / grammar 
Back to: Obsolete: Quasi-Literals and XML On to: Lexical Grammar

Methods
and Matchers


Methods and Matchers, like functions, are each a block of code with a head containing patterns and a body consisting of an expression. In all cases, the head patterns are first matched against some data (the specimen), and then, if the match succeeds, the body expression is evaluated in the resulting scope.

Unlike functions, methods and matchers are not first class -- they do not evaluate to a separate object that can be invoked. Instead, they appear only within a dispatching context. Methods and matchers are the elements that these dispatching contexts dispatch to.

Methods can appear in either object or class definitions. Matchers can appear in object or class definitions as well, and also inside switch expressions.

Methods

 

Matchers

 

 

 
Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
ERights Home elang / grammar 
Back to: Obsolete: Quasi-Literals and XML On to: Lexical Grammar
Download    FAQ    API    Mail Archive    Donate

report bug (including invalid html)

Golden Key Campaign Blue Ribbon Campaign