Table Of Contents

Previous topic

Lasso Domain

This Page

Lasso Domain Reference

The Lasso domain (ls:) provides directives for each language element, as well as corresponding roles for cross-referencing. See the domain docs for more detail on syntax.

Directives

Each directive populates the index.

.. ls:type:: name
.. ls:trait:: name
.. ls:thread:: name

Describes a type, trait, or thread. Member methods belonging to this element should be nested below or qualified with the element->member syntax.

import, imports
A comma-separated list of imported trait names.
parent, super
The parent element can appear in types and threads, which denotes another type that the current is derived from.
.. ls:method:: name(signature)
.. ls:member:: name(signature)

Describes an unbound or member method. The member directive is intended for methods belonging to a type, although both directives are treated identically.

param, parameter
Descriptions of parameters, with or without a type constraint. If an unnamed rest parameter is included, use ... for the name.
ptype, paramtype, type
Description of parameter type if more than one word is required.
return, returns
Description of the value returned.
rtype, returntype
Further description of the return value type.
.. ls:provide:: name(signature)

Describes a provide method for a trait or type. Prefixed with provide in output to distinguish from methods and members.

Although a type’s provide methods and import statements need to be inside a trait block in Lasso code, they can appear alongside member methods in reST markup.

.. ls:require:: name(signature)

Describes a require signature for a trait. Prefixed with require in output.

Every directive also supports the see or url option for adding links to more info, and the author or authors option for adding an attribution.

Quick example

.. ls:type:: rhino

   Description of the type

   :parent: :ls:type:`mammal`
   :import: :ls:trait:`trait_horned`
   :see: http://en.wikipedia.org/wiki/Rhinoceros

   .. ls:member:: numberOfHorns(species::string)::integer

      Description of the member method

      :param string species: Specifies which species
      :return: The number of horns
type rhino

Description of the type

Parent type:mammal
Imports:trait_horned
See also:http://en.wikipedia.org/wiki/Rhinoceros
numberOfHorns(species::string) → integer

Description of the member method

Parameters:species (string) – Specifies which species
Returns:The number of horns

Roles

Cross-referencing is done with roles using the same syntax as other domains, except that member tag syntax using the arrow operator -> is used to associate types or traits with member methods, such as :meth:`bytes->getrange`. All other syntax follows what’s described in the domain docs.

Use the following roles to link to definitions of each element:

:ls:meth:

Reference a type member method, trait provide method, trait require signature, or unbound method. Be sure to include the enclosing type or trait if outside its description block.

:ls:type:
:ls:trait:
:ls:thread:

Reference a type, trait, or thread.

Quick example

The :ls:type:`Pair <pair>` type always contains two elements which are accessed
with the :ls:meth:`pair->first` and :ls:meth:`~pair->second` methods.

The Pair type always contains two elements which are accessed with the pair->first and second methods.