Ultra 0.9.4
Loading...
Searching...
No Matches
ultra::function::params Class Referenceabstract

#include <function.h>

Inheritance diagram for ultra::function::params:
ultra::interpreter ultra::src::interpreter

Public Member Functions

virtual value_t fetch_arg (std::size_t) const =0
virtual value_t fetch_opaque_arg (std::size_t) const =0
value_t operator[] (std::size_t i) const

Detailed Description

Interface for accessing function arguments during evaluation.

The params interface abstracts argument retrieval and allows function implementations to evaluate inputs lazily. This enables optimisations such as short-circuiting, memoisation or selective evaluation.

Implementations may distinguish between referentially transparent evaluation and opaque evaluation with side effects.

Member Function Documentation

◆ fetch_arg()

virtual value_t ultra::function::params::fetch_arg ( std::size_t ) const
nodiscardpure virtual

Retrieves the value of an input parameter assuming referential transparency.

Remarks
Referential transparency allows caching and other optimisations. Repeated calls with the same index must return the same value.

Implemented in ultra::interpreter.

◆ fetch_opaque_arg()

virtual value_t ultra::function::params::fetch_opaque_arg ( std::size_t ) const
pure virtual

Retrieves the value of an input parameter without assuming referential transparency.

Remarks
This method must be used when argument evaluation may produce side effects or when caching is not safe.

Implemented in ultra::interpreter.

◆ operator[]()

value_t ultra::function::params::operator[] ( std::size_t i) const
inlinenodiscard

Accesses a parameter using referentially transparent evaluation.

Remarks
This operator is equivalent to calling fetch_arg(i).

The documentation for this class was generated from the following file: