PtcRunner.Lisp.Java.Primitive (PtcRunner v0.14.0)

Copy Markdown View Source

Native Java numeric value whose primitive overload identity is observable.

Ordinary PTC arithmetic intentionally unwraps this payload and therefore ends its Java provenance. Java dispatch validates the tag and range before using it for overload selection.

Summary

Functions

Returns whether a raw value is representable by the Java primitive kind.

Validates and unwraps one Java primitive while leaving ordinary values unchanged.

Validates and unwraps only the numeric argument positions consumed by a PTC builtin.

Types

kind()

@type kind() :: :int | :long | :float | :double

t()

@type t() :: %PtcRunner.Lisp.Java.Primitive{
  kind: kind(),
  value: integer() | float() | atom()
}

Functions

in_range?(kind, value)

@spec in_range?(kind(), term()) :: boolean()

Returns whether a raw value is representable by the Java primitive kind.

new(arg1, value)

@spec new(kind(), term()) :: {:ok, t()} | {:error, :invalid_java_value}

ordinary_numeric_value(primitive)

@spec ordinary_numeric_value(term()) :: {:ok, term()} | {:error, :invalid_java_value}

Validates and unwraps one Java primitive while leaving ordinary values unchanged.

prepare_arguments(name, arguments)

@spec prepare_arguments(atom(), [term()]) ::
  {:ok, [term()]} | {:error, :invalid_java_value}

Validates and unwraps only the numeric argument positions consumed by a PTC builtin.

unwrap(primitive)

@spec unwrap(t()) ::
  {:ok, integer() | float() | atom()} | {:error, :invalid_java_value}

valid?(primitive)

@spec valid?(term()) :: boolean()