Module erts_internal

An implementation of a subset of the Erlang/OTP erts_internal interface.

Description

These functions are not meant to be called directly. They are helpers, called from code generated by the compiler. In particular mc_iterator/1 and mc_refill/1 implement map comprehensions (#{K => V || K := V <- M}), introduced in OTP 26. The generated bytecode is identical from OTP 26 to at least OTP 29.

Function Index

mc_iterator/1 Start iterating over a map comprehension generator.
mc_refill/1 Advance a map comprehension iterator.

Function Details

mc_iterator/1


mc_iterator(MapOrIter) -> Iter

MapOrIter: a map or a map iterator to iterate over

returns: the first association as {Key, Value, NextIterator}, none if the map or iterator is empty, or [] if the argument is not a valid generator

Start iterating over a map comprehension generator.

This function is a helper called from compiler generated code for map comprehensions. It must be kept compatible as long as code calling this helper can still be loaded.

mc_refill/1


mc_refill(IterMap) -> Iter
  • IterMap = nonempty_improper_list(non_neg_integer() | list(), map())
  • Iter = {term(), term(), maps:iterator()} | none

IterMap: a map iterator to refill

returns: the next association as {Key, Value, NextIterator} or none

Advance a map comprehension iterator.

This function is a helper called from compiler generated code for map comprehensions. It must be kept compatible as long as code calling this helper can still be loaded.