Metastatic.Supplemental.CompatibilityMatrix (Metastatic v0.10.4)

View Source

Provides a compatibility matrix showing which supplemental modules support which constructs for each language.

This module helps developers understand cross-language support and identify gaps in supplemental coverage.

Examples

# Get full matrix
matrix = CompatibilityMatrix.build()

# Check if a construct is supported in a language
CompatibilityMatrix.supported?(:actor_call, :python)
# => true (via Pykka supplemental)

# Get all languages supporting a construct
CompatibilityMatrix.languages_for_construct(:actor_call)
# => [:python]

# Get all constructs supported in a language
CompatibilityMatrix.constructs_for_language(:python)
# => [:actor_call, :actor_cast, :spawn_actor, :async_await, ...]

Summary

Functions

Builds the full compatibility matrix from registered supplementals.

Lists all constructs supported in a target language.

Generates a detailed report showing all supplementals and their support.

Generates a text-based compatibility matrix table.

Lists all languages that support a given construct.

Gets supplemental modules providing a construct for a language.

Checks if a construct is supported in a target language.

Types

construct()

@type construct() :: atom()

language()

@type language() :: atom()

matrix()

@type matrix() :: %{
  required(construct()) => %{required(language()) => [module_name :: atom()]}
}

Functions

build()

@spec build() :: matrix()

Builds the full compatibility matrix from registered supplementals.

Returns a nested map structure:

  • First level: construct name (e.g., :actor_call)
  • Second level: language (e.g., :python)
  • Value: list of modules providing support

Examples

iex> matrix = CompatibilityMatrix.build()
iex> matrix[:actor_call][:python]
[Metastatic.Supplemental.Python.Pykka]

constructs_for_language(language)

@spec constructs_for_language(language()) :: [construct()]

Lists all constructs supported in a target language.

Examples

iex> constructs = CompatibilityMatrix.constructs_for_language(:python)
iex> :actor_call in constructs
true

iex> CompatibilityMatrix.constructs_for_language(:unknown_language)
[]

detailed_report()

@spec detailed_report() :: String.t()

Generates a detailed report showing all supplementals and their support.

Examples

iex> report = CompatibilityMatrix.detailed_report()
iex> is_binary(report)
true

format_table(opts \\ [])

@spec format_table(keyword()) :: String.t()

Generates a text-based compatibility matrix table.

Shows which constructs are supported in which languages.

Options

  • :format - Output format :text (default) or :markdown

Examples

iex> table = CompatibilityMatrix.format_table()
iex> is_binary(table)
true

languages_for_construct(construct)

@spec languages_for_construct(construct()) :: [language()]

Lists all languages that support a given construct.

Examples

iex> CompatibilityMatrix.languages_for_construct(:actor_call)
[:python]

iex> CompatibilityMatrix.languages_for_construct(:unknown_construct)
[]

providers_for(construct, language)

@spec providers_for(construct(), language()) :: [module()]

Gets supplemental modules providing a construct for a language.

Examples

iex> CompatibilityMatrix.providers_for(:actor_call, :python)
[Metastatic.Supplemental.Python.Pykka]

iex> CompatibilityMatrix.providers_for(:unknown, :python)
[]

supported?(construct, language)

@spec supported?(construct(), language()) :: boolean()

Checks if a construct is supported in a target language.

Examples

iex> CompatibilityMatrix.supported?(:actor_call, :python)
true

iex> CompatibilityMatrix.supported?(:actor_call, :go)
false