SPVM::ExchangeAPI(3)

πŸ“¦ version 0.990125, in alpine 3.24

πŸ¦‹ SPVM::ExchangeAPI ✨ (the SPVM Exchange API, bestie)

okay so this is the manual page for SPVM::ExchangeAPI β€” officially filed under SPVM::ExchangeAPI(3), in User Contributed Perl Documentation, and it's basically the whole bridge between Perl-land and SPVM-land. grab a snack, we're going through all of it πŸ’…


🌸 NAME 🌸

SPVM::ExchangeAPI β€” the SPVM Exchange API. that's it, that's the name, no cap.


πŸ’– DESCRIPTION πŸ’–

SPVM::ExchangeAPI is APIs to convert Perl data structures to/from SPVM data structures, and to call SPVM methods from Perl. it's literally the friend-group group chat between the two languages 🫢


✨ USAGE ✨

look at her go:

use SPVM ();
my $api = SPVM::api();
my $spvm_int_array = $api->new_int_array([1, 2, 3]);
my $perl_array_ref = $spvm_int_array->to_array;

my $spvm_string = $api->new_string("abc");
my $perl_string = $spvm_string->to_string;

use SPVM 'Int';
my $int_object = Int->new(4);
my $value = $int_object->value;

that's the whole vibe. Perl array in, SPVM array out, and back again. iconic ✨


πŸŽ€ LOADING SPVM CLASS πŸŽ€

# Load an SPVM class
use SPVM 'SomeClass';

# Load only SPVM module
use SPVM ();

The use statement loads a SPVM class. πŸ“š

An SPVM class is loaded and is bound to a Perl module.

The bound Perl class name is prefixed with SPVM::. so like, Int shows up on the Perl side dressed as SPVM::Int. slay πŸŽ€

Exceptions:

If the SPVM module cannot be loaded, an exception is thrown. 😭 (rude but fair)

Examples:

use SPVM 'Int';

my $int_object = SPVM::Int->new(3);
my $value = $int_object->value.

(yes, that trailing . is right there in the original, i'm not touching it πŸ’€)


🫢 SPVM FUNCTIONS 🫢

api

my $api = SPVM::api();

Gets the global SPVM::ExchangeAPI object for this Perl interpreter. one api to rule them all, main character energy πŸ‘‘


πŸ’… FIELDS πŸ’…

env

my $env = $api->env;

Gets the current execution environment. that's the world she's living in 🌍

stack

my $stack = $api->stack;

Gets the current call stack. who called whom, the receipts πŸ“š


πŸ‘‘ CLASS METHODS πŸ‘‘

my $api = SPVM::ExchangeAPI->new(env => $env, stack => $stack);

Creates a new SPVM::ExchangeAPI object. fresh api, fresh start πŸ¦‹

Options:

  • env β€” An execution environment. env must be a SPVM::Bulder::Env or SPVM::BlessedObject::Class object of Native::Env class.
  • stack β€” An call stack. stack must be a SPVM::Bulder::Stack or SPVM::BlessedObject::Class object of Native::Stack class.

new_string

my $spvm_string = $api->new_string($string);

Converts the Perl scalar $string to an SPVM string using perlapi SvPV (perldoc.perl.org/perlapi#SvPV), and returns the object that converts it to a SPVM::BlessedObject::String object. ✨

If $string is undef, returns undef.

If $string is a SPVM::BlessedObject::String object, returns itself. (she's already that girl, no dupe needed πŸ’…)

Exceptions:

$string must be a non-reference scalar or an SPVM::BlessedObject::String object or undef. Otherwise an exception is thrown. 🚨

Examples:

my $spvm_string = $api->new_string("abc");

my $spvm_string = $api->new_string("あいう");

new_byte_array

my $spvm_array = $api->new_byte_array($array);

Converts the Perl array reference $array to an SPVM byte array, and returns the object that converts it to a SPVM::BlessedObject::Array object. 🧚

Each element is converted by the conversion of "byte Type Argument".

If $array is undef, returns undef.

If $array is a SPVM::BlessedObject::Array object, returns itself.

Exceptions:

  • $array: If it is a reference, it must be an array reference. Otherwise an exception is thrown.
  • $array: If it is an SPVM::BlessedObject::Array object, the type must be the byte[] type. Otherwise an exception is thrown.

Examples:

my $spvm_array = $api->new_byte_array([1, 2, 3]);

new_byte_array_unsigned

my $spvm_array = $api->new_byte_array_unsigned($array);

The same as new_byte_array method, but each element is converted by SvUV perlapi and a type cast to uint8_t in the C language. unsigned era πŸ”₯

(int8_t)(uint8_t)SvUV(perl_scalar);

new_byte_array_len

my $spvm_array= $api->new_byte_array_len($length);

Creates an SPVM byte array with the length $length, and returns the object that converts it to a SPVM::BlessedObject::Array object. πŸ“

Exceptions:

$length must be greater than or equal to 0. Otherwise an exception is thrown. no negative lengths, we don't do that here πŸ™ˆ

Examples:

my $length = 10;
my $spvm_array = $api->new_byte_array_len($length);

new_byte_array_from_bin

my $spvm_array = $api->new_byte_array_from_bin($binary);

Converts the binary date $binary to an SPVM byte array, and returns the object that converts it to a SPVM::BlessedObject::Array object. πŸ“

$binary is copied to an SPVM byte array by the memcpy function in the C laugnage. The length of the array is calcurated from $binary. (yes, "laugnage" and "calcurated", we keep the originals verbatim, i don't make the rules πŸ’€)

Exceptions:

$binary must be a defined non-reference scalar. Otherwise an exception is thrown.

Examples:

my $binary = pack('c*', 97, 98, 99);
my $spvm_array = $api->new_byte_array_from_bin($binary);

my $string = "abc";
my $spvm_array = $api->new_byte_array_from_bin($string);

my $string = "あいう";
my $spvm_array = $api->new_byte_array_from_bin($string);

new_short_array

my $spvm_array = $api->new_short_array($array);

Converts the Perl array reference $array to an SPVM short array, and returns the object that converts it to a SPVM::BlessedObject::Array object. 🌸

Each element is converted by the conversion of "short Type Argument".

If $array is undef, returns undef.

If $array is a SPVM::BlessedObject::Array object, returns itself.

Exceptions:

  • $array: If it is a reference, it must be an array reference. Otherwise an exception is thrown.
  • $array: If it is an SPVM::BlessedObject::Array object, the type must be the short[] type. Otherwise an exception is thrown.

Examples:

my $spvm_array = $api->new_short_array([1, 2, 3]);

new_short_array_unsigned

my $spvm_array = $api->new_short_array_unsigned($array);

The same as new_short_array method, but each element is converted by SvUV perlapi and a type cast to uint16_t in the C language.

(int16_t)(uint16_t)SvUV(perl_scalar);

new_short_array_len

my $spvm_array = $api->new_short_array_len($length);

Creates an SPVM short array with the length $length, and returns the object that converts it to a SPVM::BlessedObject::Array object.

Exceptions:

$length must be greater than or equal to 0. Otherwise an exception is thrown.

Examples:

my $length = 10;
my $spvm_array = $api->new_short_array_len($length);

new_short_array_from_bin

my $spvm_array = $api->new_short_array_from_bin($binary);

Converts the binary date $binary to an SPVM short array, and returns the object that converts it to a SPVM::BlessedObject::Array object. πŸ¦‹

$binary is copied to an SPVM short array by the memcpy function in the C laugnage. The length of the array is calcurated from $binary.

Exceptions:

$binary must be a defined non-reference scalar. Otherwise an exception is thrown.

The length of $binary must be divisible by 2. Otherwise an exception is thrown. ⚠️ two-byte alignment check, don't skip it

Examples:

my $binary = pack('s*', 97, 98, 99);
my $spvm_array = $api->new_short_array_from_bin($binary);

new_int_array

my $spvm_array = $api->new_int_array($array);

Converts the Perl array reference $array to an SPVM int array, and returns the object that converts it to a SPVM::BlessedObject::Array object. πŸ”₯

Each element is converted by the conversion of "int Type Argument".

If $array is undef, returns undef.

If $array is a SPVM::BlessedObject::Array object, returns itself.

Exceptions:

  • $array: If it is a reference, it must be an array reference. Otherwise an exception is thrown.
  • $array: If it is an SPVM::BlessedObject::Array object, the type must be the int[] type. Otherwise an exception is thrown.

Examples:

my $spvm_array = $api->new_int_array([1, 2, 3]);

new_int_array_unsigned

my $spvm_array = $api->new_int_array_unsigned($array);

The same as new_int_array method, but each element is converted by SvUV perlapi and a type cast to uint32_t in the C language.

(int32_t)(uint32_t)SvUV(perl_scalar);

new_int_array_len

my $spvm_array = $api->new_int_array_len($length);

Creates an SPVM int array with the length $length, and returns the object that converts it to a SPVM::BlessedObject::Array object. πŸ“

Exceptions:

$length must be greater than or equal to 0. Otherwise an exception is thrown.

Examples:

my $length = 10;
my $spvm_array = $api->new_int_array_len($length);

new_int_array_from_bin

my $spvm_array = $api->new_int_array_from_bin($binary);

Converts the binary date $binary to an SPVM int array, and returns the object that converts it to a SPVM::BlessedObject::Array object. 🧚

$binary is copied to an SPVM int array by the memcpy function in the C laugnage. The length of the array is calcurated from $binary.

Exceptions:

$binary must be defined. Otherwise an exception is thrown.

The length of $binary must be divisible by 4. Otherwise an exception is thrown. ⚠️

Examples:

my $binary = pack('l*', 97, 98, 99);
my $spvm_array = $api->new_int_array_from_bin($binary);

new_long_array

my $spvm_array = $api->new_long_array($array);

Converts the Perl array reference $array to an SPVM long array, and returns the object that converts it to a SPVM::BlessedObject::Array object. Each element is converted by the conversion of "long Type Argument". πŸ’œ

If $array is undef, returns undef.

Exceptions:

  • $array: If it is a reference, it must be an array reference. Otherwise an exception is thrown.
  • $array: If it is an SPVM::BlessedObject::Array object, the type must be the long[] type. Otherwise an exception is thrown.

Examples:

my $spvm_array = $api->new_long_array([1, 2, 3]);

new_long_array_unsigned

my $spvm_array = $api->new_long_array_unsigned($array);

The same as new_long_array method, but each element is converted by SvUV perlapi and a type cast to uint64_t in the C language.

(int64_t)(uint64_t)SvUV(perl_scalar);

new_long_array_len

my $spvm_array = $api->new_long_array_len($length);

Creates an SPVM long array with the length $length, and returns the object that converts it to a SPVM::BlessedObject::Array object.

Exceptions:

$length must be greater than or equal to 0. Otherwise an exception is thrown.

Examples:

my $length = 10;
my $spvm_array = $api->new_long_array_len($length);

new_long_array_from_bin

my $spvm_array = $api->new_long_array_from_bin($binary);

Converts the binary date $binary to an SPVM long array, and returns the object that converts it to a SPVM::BlessedObject::Array object. 🌈

$binary is copied to an SPVM long array by the memcpy function in the C laugnage. The length of the array is calcurated from $binary.

Exceptions:

$binary must be defined. Otherwise an exception is thrown.

The length of $binary must be divisible by 8. Otherwise an exception is thrown. ⚠️ eight, not four, don't @ me

Examples:

my $binary = pack('q*', 97, 98, 99);
my $spvm_array = $api->new_long_array_from_bin($binary);

new_float_array

my $spvm_array = $api->new_float_array($array);

…and that's where part 1 runs out, bestie β€” the new_float_array entry keeps going in part 2, so don't go anywhere 🌸

Okay so new_float_array converts the Perl array reference $array into an SPVM float array, and gives you back the object that converts it to an SPVM::BlessedObject::Array object. πŸ’–

Each element gets converted by the conversion of "float Type Argument".

If $array is undef, you get undef back. If $array is already an SPVM::BlessedObject::Array object, it returns itself β€” iconic behavior, honestly.

Exceptions:

  • $array: if it’s a reference, it must be an array reference. Otherwise an exception gets thrown 😭.
  • $array: if it’s an SPVM::BlessedObject::Array object, the type must be the float[] type. Otherwise an exception gets thrown πŸ’€.

Examples:

my $spvm_array = $api->new_float_array([1, 2, 3]);

✨ new_float_array_len ✨

my $spvm_array = $api->new_float_array_len($length);

Creates an SPVM float array with the length $length, and returns the object that converts it to a SPVM::BlessedObject::Array object. 🫢

Exceptions:

  • $length must be greater than or equal to 0. Otherwise an exception gets thrown.

Examples:

my $length = 10;
my $spvm_array = $api->new_float_array_len($length);

πŸŽ€ new_float_array_from_bin πŸŽ€

my $spvm_array = $api->new_float_array_from_bin($binary);

Converts the binary data $binary to an SPVM float array, and returns the object that converts it to a SPVM::BlessedObject::Array object.

$binary is copied to an SPVM float array by the "memcpy" function in the C language. The length of the array is calculated from $binary.

Exceptions:

  • $binary must be defined. Otherwise an exception gets thrown.
  • The length of $binary must be divisible by 4. Otherwise an exception gets thrown 😭.

Examples:

my $binary = pack('f*', 97.1, 98.2, 99.3);
my $spvm_array = $api->new_float_array_from_bin($binary);

πŸ¦‹ new_double_array πŸ¦‹

my $spvm_array = $api->new_double_array($array);

Converts the Perl array reference $array to an SPVM double array, and returns the object that converts it to a SPVM::BlessedObject::Array object.

Each element is converted by the conversion of "double Type Argument".

Exceptions:

  • $array: if it’s a reference, it must be an array reference. Otherwise an exception gets thrown.
  • $array: if it’s an SPVM::BlessedObject::Array object, the type must be the double[] type. Otherwise an exception gets thrown πŸ’€.

Examples:

my $spvm_array = $api->new_double_array([1, 2, 3]);

🌸 new_double_array_len 🌸

my $spvm_array = $api->new_double_array_len($length);

Creates an SPVM double array with the length $length, and returns the object that converts it to a SPVM::BlessedObject::Array object.

Exceptions:

  • $length must be greater than or equal to 0. Otherwise an exception gets thrown.

Examples:

my $length = 10;
my $spvm_array = $api->new_double_array_len($length);

πŸ’œ new_double_array_from_bin πŸ’œ

my $spvm_array = $api->new_double_array_from_bin($binary);

Converts the binary data $binary to an SPVM double array, and returns the object that converts it to a SPVM::BlessedObject::Array object.

$binary is copied to an SPVM double array by the "memcpy" function in the C language. The length of the array is calculated from $binary.

Exceptions:

  • $binary must be defined. Otherwise an exception gets thrown.
  • The length of $binary must be divisible by 8. Otherwise an exception gets thrown 😭.

Examples:

my $binary = pack('d*', 97.1, 98.2, 99.3);
my $spvm_array = $api->new_double_array_from_bin($binary);

🌈 new_string_array 🌈

my $spvm_array = $api->new_string_array($array);

Converts the Perl array reference $array to an SPVM string array, and returns the object that converts it to a SPVM::BlessedObject::Array object. Each element is converted by the new_string method.

If $array is undef, it returns undef. If $array is an SPVM::BlessedObject::Array object, it returns itself.

Exceptions:

  • $array: if it’s a reference, it must be an array reference. Otherwise an exception gets thrown.
  • $array: if it’s an SPVM::BlessedObject::Array object, the type must be the string[] type. Otherwise an exception gets thrown πŸ’€.

Examples:

my $spvm_array = $api->new_string_array(["foo", "bar", "baz"]);

my $spvm_array = $api->new_string_array(["あい", "γ†γˆ", "お"]);

πŸ“ new_string_array_len πŸ“

my $spvm_array = $api->new_string_array_len($length);

Creates an SPVM string array with the length $length, and returns the object that converts it to a SPVM::BlessedObject::Array object.

Exceptions:

  • $length must be greater than or equal to 0. Otherwise an exception gets thrown.

Examples:

my $length = 10;
my $spvm_array = $api->new_string_array_len($length);

πŸ‘‘ new_object_array πŸ‘‘

my $spvm_object_array = $api->new_object_array($type_name, $array);

Converts the Perl array reference $array to a value of the SPVM object array (1-dimensional) type $type_name, and returns the object that converts it to a SPVM::BlessedObject::Array object of $type_name type.

If $array is undef, it gets converted to SPVM undef. If $array is an SPVM::BlessedObject::Array object, it returns itself.

Exceptions:

  • If the type name $type_name was parsed, but the class name could not be extracted, an exception gets thrown.
  • $array: if it’s a reference, it must be an array reference. Otherwise an exception gets thrown.
  • $array: if it’s an SPVM::BlessedObject::Array object, the type must satisfy the type requirement. Otherwise an exception gets thrown.
  • If the basic type of the type $type_name is not found, an exception gets thrown.
  • The dimension of the type $type_name must be 1. Otherwise an exception gets thrown.
  • $type_name must be an object array type. Otherwise an exception gets thrown πŸ’€.

Examples:

my $point1 = SPVM::Point->new;
my $point2 = SPVM::Point->new;
my $spvm_array = $api->new_object_array("Point[]", [$point1, $point2]);

⭐ new_object_array_len ⭐

my $spvm_array = $api->new_object_array_len($type_name, $length);

Creates an SPVM object array (1-dimensional) with the type name $type_name and the length $length, and returns the object that converts it to a SPVM::BlessedObject::Array object of $type_name type.

Exceptions:

  • If the type name $type_name was parsed, but the class name could not be extracted, an exception gets thrown.
  • $length must be greater than or equal to 0. Otherwise an exception gets thrown.
  • If the basic type of the type $type_name is not found, an exception gets thrown.
  • The dimension of the type $type_name must be 1. Otherwise an exception gets thrown.
  • $type_name must be an object array type. Otherwise an exception gets thrown 😭.

Examples:

my $length = 10;
my $spvm_array = $api->new_object_array("Point[]", $length);

🧚 new_any_object_array 🧚

my $byte_array = $api->new_any_object_array(
  [SPVM::Byte->new(1), SPVM::Byte>new(2), SPVM::Byte->new(3)]
);

This is the alias for the following code using the new_object_array method:

my $spvm_array = $api->new_object_array('object[]', $array);

πŸŽ€ new_any_object_array_len πŸŽ€

my $spvm_array = $api->new_any_object_array_len($length);

Creates an SPVM object array with the length $length, and returns the object that converts it to a SPVM::BlessedObject::Array object of $type_name.

Exceptions:

  • $length must be greater than or equal to 0. Otherwise an exception gets thrown.

Examples:

my $length = 10;
my $spvm_array = $api->new_any_object_array("Point[]", $length);

πŸ’… new_options πŸ’…

my $spvm_any_object_array = $api->new_options($options);

Converts the Perl hash reference $options to a value of the SPVM "object[]" type, and returns the object that converts it to a SPVM::BlessedObject::Array object.

Each key of $options is converted to an SPVM::BlessedObject::String object using the new_string method.

Exceptions:

  • The value of $options must be an SPVM::BlessedObject object. Otherwise an exception gets thrown.
  • $options must be a hash reference. Otherwise an exception gets thrown πŸ’€.

Examples:

my $options = $api->new_options({
  x => SPVM::Int->new(1),
  y => SPVM::Int->new(2)
});

πŸ”₯ new_mulnum_array πŸ”₯

my $spvm_mulnum_array = $api->new_mulnum_array($type_name, $array);

Converts the Perl array reference of hash references $array to the SPVM multi-numeric array type $type_name, and returns the object that converts it to a SPVM::BlessedObject::Array object.

Each value of the hash reference is converted by the conversion of "byte Type Argument", "short Type Argument", "int Type Argument", "long Type Argument", "float Type Argument", "double Type Argument" corresponding to the numeric type of the element of $type.

Exceptions:

  • If the type name $type_name was parsed, but the class name could not be extracted, an exception gets thrown.
  • All fields of the element type of $type_name must be defined. Otherwise an exception gets thrown.
  • If the basic type of the type $type_name is not found, an exception gets thrown.
  • The dimension of the type $type_name must be 1. Otherwise an exception gets thrown.
  • $array: if it’s a reference, it must be an array reference. Otherwise an exception gets thrown.
  • $array: if it’s an SPVM::BlessedObject::Array object, the type must satisfy the type requirement. Otherwise an exception gets thrown 😭.

Examples:

my $values = [
  {x => 0, y => 1, z => 2},
  {x => 3, y => 4, z => 5},
  {x => 6, y => 7, z => 8},
];
my $spvm_mulnum_array = $api->new_mulnum_array("TestCase::Point_3i[]", $values);

🌟 new_mulnum_array_len 🌟

my $spvm_array = $api->new_mulnum_array_len($type_name, $length);

Creates an SPVM object array with the type name $type_name and the length $length, and returns the object that converts it to a SPVM::BlessedObject::Array object of $type_name.

Exceptions:

  • $length must be greater than or equal to 0. Otherwise an exception gets thrown.
  • If the basic type of the type $type_name is not found, an exception gets thrown.
  • The dimension of $type_name must be 1. Otherwise an exception gets thrown πŸ’€.

Examples:

my $length = 10;
my $spvm_array = $api->new_mulnum_array("Complex_2d[]", $length);

πŸ’– new_mulnum_array_from_bin πŸ’–

my $spvm_mulnum_array = $api->new_mulnum_array_from_bin($type_name, $binary);

Converts the binary data $binary to an SPVM multi-numeric array type $type_name, and returns the object that converts it to a SPVM::BlessedObject::Array object.

$binary is copied to an SPVM multi-numeric array by the "memcpy" function in the C language. The length of the array is calculated from $binary.

Exceptions:

  • If the basic type of the type $type_name is not found, an exception gets thrown.
  • The dimension of the type $type_name must be 1. Otherwise an exception gets thrown.
  • $binary must be an array reference. Otherwise an exception gets thrown 😭.

The length of $binary has to be divisible by the length of fields Γ— the byte size of the element type. Like, evenly divide, no leftover crumbs. If it doesn't? Exception. Thrown. 🚨

Examples:

# new_mulnum_array_from_bin - byte
{
  my $binary = pack('c9', (0, 1, 2), (3, 4, 5), (6, 7, 8));
  my $spvm_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3b[]", $binary);
}

# new_mulnum_array_from_bin - short
{
  my $binary = pack('s9', (0, 1, 2), (3, 4, 5), (6, 7, 8));
  my $spvm_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3s[]", $binary);
}

# new_mulnum_array_from_bin - int
{
  my $binary = pack('l9', (0, 1, 2), (3, 4, 5), (6, 7, 8));
  my $spvm_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3i[]", $binary);
}

# new_mulnum_array_from_bin - long
{
  my $binary = pack('q9', (0, 1, 2), (3, 4, 5), (6, 7, 8));
  my $spvm_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3l[]", $binary);
}

# new_mulnum_array_from_bin - float
{
  my $binary = pack('f9', (0, 1, 2), (3, 4, 5), (6, 7, 8));
  my $spvm_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3f[]", $binary);
}

# new_mulnum_array_from_bin - double
{
  my $binary = pack('d9', (0, 1, 2), (3, 4, 5), (6, 7, 8));
  my $spvm_mulnum_array = $api->new_mulnum_array_from_bin("TestCase::Point_3d[]", $binary);
}

πŸŒ€ new_muldim_array

my $spvm_object_array = $api->new_muldim_array($type_name, $array);

Bestie, this takes your Perl array ref $array and converts it into a value of the SPVM multi-dimensional array type $type_name πŸ’« β€” then hands you back the object that converts it into a SPVM::BlessedObject::Array object.

If $array is undef, it becomes SPVM undef. Simple as that.

If $array is already a SPVM::BlessedObject::Array object, it just returns itself. Iconic, no notes. πŸ‘‘

Exceptions:

  • $array: if it's a reference that isn't an array reference, an exception is thrown.
  • $array: if it's a SPVM::BlessedObject::Array object, the type has to satisfy the type requirement. Otherwise an exception is thrown.
  • If the bacic type of the type $type_name is not found, an exception is thrown.
  • The dimension of $type_name must be greater than or equal to 2 and less than or equal to 255. Otherwise an exception is thrown.
  • The assignment requirement of the element to the element type of $type_name is checked. If it's not satisfied, an exception is thrown.

Examples:

my $object1 = $api->new_int_array([1, 2, 3]);
my $object2 = $api->new_int_array([4, 5, 6]);
my $objects = $api->new_muldim_array("int[][]", [$object1, $object2]);

🧱 new_muldim_array_len

my $spvm_array = $api->new_muldim_array_len($type_name, $length);

Builds you a whole SPVM multi-dimensional array with type name $type_name and length $length πŸŽ€ β€” and returns the object that converts it to a SPVM::BlessedObject::Array object of $type_name.

Exceptions:

  • $length must be greater than or equal to 0. Otherwise an exception is thrown.
  • If the bacic type of the type $type_name is not found, an exception is thrown.
  • The dimension of $type_name must be greater than or equal to 2 and less than or equal to 255. Otherwise an exception is thrown.

Examples:

my $length = 10;
my $spvm_array = $api->new_muldim_array("int[][]", $length);

😱 get_exception

my $message = $api->get_exception();

Grabs the exception sitting in the current thread variables and gives it back to you as a SPVM::BlessedObject::String object. If nothing's set? undef. Chill. πŸ“


πŸ’Œ set_exception

$api->set_exception($message);

Drops the message in $message into the exception slot of the current thread variables. $message gets converted to an SPVM string using the "new_string" method, iykyk.

Exceptions:

  • Exceptions thrown by the "new_string" method are thrown.

Examples:

$api->set_exception("Error");
$api->set_exception(undef);

πŸ“Š get_memory_blocks_count

my $count = $api->get_memory_blocks_count;

Tells you how many memory blocks the current runtime has allocated. Basically a vibe check for your memory 😌

Examples:

# First Memory Blocks Count
my $start_memory_blocks_count = $api->get_memory_blocks_count;

# Processing
# ...

# Last Memory Blocks Count
my $end_memory_blocks_count = $api->get_memory_blocks_count;

unless ($end_memory_blocks_count == $start_memory_blocks_count) {
  die"Memroy leak";
}
Ngl that die"Memroy leak"; is exactly how it's spelled in the original. Copy it character for character or your leak detector is a different leak detector πŸ’€

🏫 class

my $class = $api->class($basic_type_name);

Makes a brand-new SPVM::ExchangeAPI::Class object with the class name $basic_type_name and hands it over 🫢

Examples:

my $class = $api->class('Int');
my $spvm_object = $class->new(1);

πŸ” dump

my $dump = $api->dump($object);

Runs the dump operator on the SPVM object $object, turns it into a dumped string, and returns it. Peek behind the curtain bestie ✨

Exceptions:

  • $object must be a SPVM::BlessedObject object. Otherwise an exception is thrown.

🚧 error

my $error = $api->new_error;

Creates a fresh SPVM::ExchangeAPI::Error object and returns it. The error id is set to 0. Clean slate energy πŸ’…


πŸ“ž call_method

my $ret = $api->call_method($invocant, $method_name, @args);

my $ret = $api->call_method($invocant, $method_name, @args, $error);

The main character of this whole page, fr. Calls a class method or an instance method 🎯

  • If the invocant $invocant is a string β†’ a class method gets called.
  • If the invocant $invocant is a SPVM::BlessedObject::Class β†’ an instance method gets called.

Every one of the arguments in @args goes through the rules in "Argument Conversion".

The method name $method_name also accepts a static method name like "Foo::bar" πŸ‘€

The return value gets converted by the rules in "Return Value Conversion".

And if a SPVM::ExchangeAPI::Error object is passed as the last of the arguments, and an exception gets thrown from an SPVM method, the error code is set to the "code" field of that object. Handy.

Exceptions:

  • If $invocant is an SPVM::BlessedObject, $invocant must be an SPVM::BlessedObject::Class object. Otherwise an exception is thrown.
  • The static method call must be valid. Otherwise an exception is thrown.
  • If the M method in the C class is not found, an exception is thrown.
  • If too few arguments are passed to the M method in the C class, an exception is thrown.
  • If too many arguments are passed to the M method in the C class, an exception is thrown.
  • If argument conversion fails, an exception is thrown.
  • If the calling method throws an exception, the exception is thrown.

Examples:

# Class method call
my $obj_int = $api->call_method("Int", "new", 1);

# Instance method call
$api->call_method($obj_int, "set_value", 5);
my $value = $api->call_method($obj_int, "value");

# Call static instance method
$api->call_method($object, "Foo::value");

Easy Ways:

Calling class methods can be made easier using SPVM class loading feature πŸ”₯

use SPVM 'Int';
my $int_object = Int->new(4);

Instance method calls can be made easier using SPVM::BlessedObject::Class πŸ’–

my $value = $int_object->value;

🧹 destroy_runtime_permanent_vars

$api->destroy_runtime_permanent_vars;

Same as Fn#destroy_runtime_permanent_vars method. That's it, that's the whole thing. 🧼


🏷️ get_version_string

my $version_string = $api->get_version_string("MyClass");

Same as Fn#get_version_string method. Also that's it. 🌈


πŸ’¬ Argument Conversion πŸ’¬

Okay so every argument you pass to the "call_method" method gets converted to an SPVM value according to its SPVM type before it ever reaches an SPVM method. Think of it as a little backstage makeover montage 🧚

πŸ”’ byte Type Argument

A Perl scalar becomes a value of the SPVM "byte" type via SvIV (perlapi, https://perldoc.perl.org/perlapi#SvIV) and then a type cast to "int8_t" in the C language.

(int8_t)SvIV(perl_scalar)

Exceptions:

  • The argument must be a non-reference scalar. Otherwise an exception is thrown.

πŸ”’ short Type Argument

A Perl scalar becomes a value of the SPVM "short" type via SvIV (perlapi, https://perldoc.perl.org/perlapi#SvIV) and then a type cast to "int16_t" in the C language.

(int16_t)SvIV(perl_scalar)

Exceptions:

  • The argument must be a non-reference scalar. Otherwise an exception is thrown.

πŸ”’ int Type Argument

A Perl scalar becomes a value of the SPVM "int" type via SvIV (perlapi, https://perldoc.perl.org/perlapi#SvIV) and then a type cast to "int32_t" in the C language.

(int32_t)SvIV(perl_scalar)

Exceptions:

  • The argument must be a non-reference scalar. Otherwise an exception is thrown.

Examples:

my $int_object = SPVM::Int->new(10);

πŸ”’ long Type Argument

A Perl scalar becomes a value of the SPVM "long" type via SvIV (perlapi, https://perldoc.perl.org/perlapi#SvIV) and then a type cast to "int64_t" in the C language.

(int64_t)SvIV(perl_scalar)

Exceptions:

  • The argument must be a non-reference scalar. Otherwise an exception is thrown.

Examples:

my $long_object = SPVM::Long->new(10);

πŸ”’ float Type Argument

A Perl scalar becomes a value of the SPVM "float" type via SvNV (perlapi, https://perldoc.perl.org/perlapi#SvNV) and then a type cast to "float" in the C language.

(float)SvNV(perl_scalar)

Exceptions:

  • The argument must be a non-reference scalar. Otherwise an exception is thrown.

Examples:

my $float_object = SPVM::Float->new(10.5);

πŸ”’ double Type Argument

A Perl scalar becomes a value of the SPVM "double" type via SvNV (perlapi, https://perldoc.perl.org/perlapi#SvNV) and then a type cast to "double" in the C language.

(double)SvNV(perl_scalar)

Exceptions:

  • The argument must be a non-reference scalar. Otherwise an exception is thrown.

Examples:

my $double_object = SPVM::Double->new(10.5);

🧡 string Type Argument

A Perl scalar becomes a value of the SPVM "string" type via the "new_string" method ✨

Exceptions:

  • Exceptions thrown by the "new_string" method are thrown.

Examples:

my $substr = SPVM::Fn->substr("abcde", 0, 3);

πŸ“¦ Any Object Type Argument

No conversion happens. Zero. None. The argument just walks in as-is πŸšΆβ€β™€οΈ

Exceptions:

  • The argument must be an SPVM::BlessedObject object or undef. Otherwise an exception is thrown.

πŸŽ“ Class Type Argument

Again, no conversion performed. Nothing to see here.

Exceptions:

  • The argument must be an SPVM::BlessedObject::Class object that can be assigned to Z type, or undef. Otherwise an exception is thrown.

🧩 Interaface Type Argument

Nope, still no conversion.

Exceptions:

  • The argument must be an SPVM::BlessedObject::Class object that can be assigned to Z type, or undef. Otherwise an exception is thrown.

πŸ”‘ Multi-Numeric Type Argument

Multi-Numeric byte

Takes a hash reference packed with field names and their values for the multi-numeric byte type, and converts it into a value of the multi-numeric byte type πŸŽ€

Each field value gets converted by the conversion of "byte Type Argument".

Exceptions:

The argument has to be a hash reference, bestie. If it's not? An exception gets thrown, no cap. 😭

And if a field isn't found in there? Yeah, exception again. It's giving strict.

Examples:

# Converts a Perl hash reference to MyClassPoint_2b type
SPVM::MyClass->foo({x => 1, y => 2});

Multi-Numeric short Type Argument

Okay so this one takes a hash reference holding field names and their values of the multi-numeric short type, and converts the whole thing into a value of the multi-numeric short type. ✨

Every single field value gets run through the conversion described in "short Type Argument". One by one, bestie. πŸ’…

Exceptions β€” because of course:

  • The argument must be a hash reference. Otherwise an exception is thrown.
  • If a field is not found, an exception is thrown.

Examples:

# Converts a Perl hash reference to MyClassPoint_2s type
SPVM::MyClass->foo({x => 1, y => 2});

Multi-Numeric int Type Argument

Same vibe, but int-flavoured: converts a hash reference containing field names and their values of the multi-numeric int type into a value of the multi-numeric int type. 🧚

Each field value is converted by the conversion of "int Type Argument". Every field, individually, yes.

Exceptions:

  • The argument must be a hash reference. Otherwise an exception is thrown.
  • If a field is not found, an exception is thrown.

Examples:

# Converts a Perl hash reference to MyClassPoint_2i type
SPVM::MyClass->foo({x => 1, y => 2});

Multi-Numeric long Type Argument

Now we're doing the long version, lowkey iconic: converts a hash reference containing field names and their values of the multi-numeric long type to a value of the multi-numeric long type. πŸ¦‹

Each field value is converted by the conversion of "long Type Argument".

Exceptions:

  • The argument must be a hash reference. Otherwise an exception is thrown.
  • If a field is not found, an exception is thrown.

Examples:

# Converts a Perl hash reference to MyClassPoint_2l type
SPVM::MyClass->foo({x => 1, y => 2});

Multi-Numeric float Type Argument

Floats, my beloved. πŸ“ This converts a hash reference containing field names and their values of the multi-numeric float type to a value of the multi-numeric float type.

Each field value is converted by the conversion of "float Type Argument".

Exceptions:

  • The argument must be a hash reference. Otherwise an exception is thrown.
  • If a field is not found, an exception is thrown.

Examples:

# Converts a Perl hash reference to MyClassPoint_2f type
SPVM::MyClass->foo({x => 1.2, y => 2.3});

Multi-Numeric double Type Argument

And the double one, ate as always: converts a hash reference containing field names and their values of the multi-numeric double type to a value of the multi-numeric double type. πŸ’œ

Each field value is converted by the conversion of "double Type Argument".

Exceptions:

  • The argument must be a hash reference. Otherwise an exception is thrown.
  • If a field is not found, an exception is thrown.

Examples:

# Converts a Perl hash reference to MyClassPoint_2d type
SPVM::MyClass->foo({x => 1.2, y => 2.3});

Numeric Reference Type Argument

Now we're in reference territory β€” pointers, bestie, by reference energy. 🌈

byte Reference Type Argument

A Perl reference gets converted to a value of the SPVM byte reference type. ✨

The value being pointed at gets converted to a value of the SPVM "byte" type via the conversion of "byte Type Argument".

Then, after returning from the SPVM method, that referenced value gets converted to a Perl scalar via the conversion of "byte Type Return Value". It goes both ways, it's giving main character energy. πŸ’…

Exceptions:

  • The argument must be a scalar reference. Otherwise an exception is thrown.

Examples:

# Converts a Perl scalar reference to byte* type
my $value = 23;
SPVM::MyClass->foo(\$value);

short Reference Type Argument

A Perl reference gets converted to a value of the SPVM short reference type. πŸŽ€

The referenced value gets converted to a value of the SPVM "short" type via the conversion of "short Type Argument".

After returning from the SPVM method, the referenced value gets converted to a Perl scalar via the conversion of "short Type Return Value".

Exceptions:

  • The argument must be a scalar reference. Otherwise an exception is thrown.

Examples:

# Converts a Perl scalar reference to short* type
my $value = 23;
SPVM::MyClass->foo(\$value);

int Reference Type Argument

A Perl reference gets converted to a value of the SPVM int reference type. πŸ”₯

The referenced value gets converted to a value of the SPVM "int" type via the conversion of "int Type Argument".

After returning from the SPVM method, the referenced value gets converted to a Perl scalar via the conversion of "int Type Return Value".

Exceptions:

  • The argument must be a scalar reference. Otherwise an exception is thrown.

Examples:

# Converts a Perl scalar reference to int* type
my $value = 23;
SPVM::MyClass->foo(\$value);

long Reference Type Argument

A Perl reference gets converted to a value of the SPVM long reference type. 🌸

The referenced value gets converted to a value of the SPVM "long" type via the conversion of "long Type Argument".

After returning from the SPVM method, the referenced value gets converted to a Perl scalar via the conversion of "long Type Return Value".

Exceptions:

  • The argument must be a scalar reference. Otherwise an exception is thrown.

Examples:

# Converts a Perl scalar reference to long* type
my $value = 23;
SPVM::MyClass->foo(\$value);

float Reference Type Argument

A Perl reference gets converted to a value of the SPVM float reference type. 🫢

The referenced value gets converted to a value of the SPVM "float" type via the conversion of "float Type Argument".

After returning from the SPVM method, the referenced value gets converted to a Perl scalar via the conversion of "float Type Return Value".

Exceptions:

  • The argument must be a scalar reference. Otherwise an exception is thrown.

Examples:

# Converts a Perl scalar reference to float* type
my $value = 23.5;
SPVM::MyClass->foo(\$value);

double Reference Type Argument

A Perl reference gets converted to a value of the SPVM double reference type. πŸ‘‘

The referenced value gets converted to a value of the SPVM "double" type via the conversion of "double Type Argument".

After returning from the SPVM method, the referenced value gets converted to a Perl scalar via the conversion of "double Type Return Value".

Exceptions:

  • The argument must be a scalar reference. Otherwise an exception is thrown.

Examples:

# Converts a Perl scalar reference to double* type
my $value = 23.5;
SPVM::MyClass->foo(\$value);

Multi-Numeric Reference Type Argument

Reference-to-multi-numeric time. Yes, there's layers. Yes, it's a lot. Keep up bestie, we're slaying. πŸ’€βœ¨

Multi-Numeric byte Reference Type Argument

A Perl reference gets converted to an SPVM multi-numeric "byte" reference type. πŸ¦‹

Each field gets converted to a value of the SPVM "byte" type via the conversion of "byte Type Argument".

After returning from the SPVM method, each field value gets converted to a Perl scalar via the conversion of "byte Type Return Value". Everybody out here getting converted.

Exceptions:

  • The reference must be a scalar reference to a hash reference. Otherwise an exception is thrown.
  • If a field is not found, an exception is thrown.
Note the glow-up here: this time it's a scalar reference to a hash reference, not just a plain hash reference. Two layers, bestie. Don't mix them up or it's exception o'clock. ⭐

Examples:

# Converts a Perl scalar reference to a hash reference to the MyClassPoint_2b* type
my $value = {x => 1, y => 2};
SPVM::MyClass->foo(\$value);

Multi-Numeric short Reference Type Argument

A Perl reference gets converted to an SPVM multi-numeric "short" reference type. πŸŽ€

Each field gets converted to a value of the SPVM "short" type via the conversion of "short Type Argument".

After returning from the SPVM method, each field value gets converted to a Perl scalar via the conversion of "short Type Return Value".

Exceptions:

  • The reference must be a scalar reference to a hash reference. Otherwise an exception is thrown.
  • If a field is not found, an exception is thrown.

Examples:

# Converts a Perl scalar reference to a hash reference to the MyClassPoint_2s* type
my $value = {x => 1, y => 2};
SPVM::MyClass->foo(\$value);

Multi-Numeric int Reference Type Argument

A Perl reference gets converted to an SPVM multi-numeric "int" reference type. πŸ”₯

Each field gets converted to a value of the SPVM "int" type via the conversion of "int Type Argument".

After returning from the SPVM method, each field value gets converted to a Perl scalar via the conversion of "int Type Return Value".

Exceptions:

  • The reference must be a scalar reference to a hash reference. Otherwise an exception is thrown.
  • If a field is not found, an exception is thrown.

Examples:

# Converts a Perl scalar reference to a hash reference to the SPVM MyClassPoint_2i* type
my $value = {x => 1, y => 2};
SPVM::MyClass->foo(\$value);

Multi-Numeric long Reference Type Argument

A Perl reference gets converted to an SPVM multi-numeric "long" reference type. 🌈

Each field gets converted to a value of the SPVM "long" type via the conversion of "long Type Argument".

After returning from the SPVM method, each field value gets converted to a Perl scalar via the conversion of "long Type Return Value".

Exceptions:

  • The reference must be a scalar reference to a hash reference. Otherwise an exception is thrown.
  • If a field is not found, an exception is thrown.

Examples:

# Converts a Perl scalar reference to a hash reference to the SPVM MyClassPoint_2l* type
my $value = {x => 1, y => 2};
SPVM::MyClass->foo(\$value);

Multi-Numeric float Reference Type Argument

A Perl reference gets converted to an SPVM multi-numeric "float" reference type. πŸ“

Each field gets converted to a value of the SPVM "float" type via the conversion of "float Type Argument".

After returning from the SPVM method, each field value gets converted to a Perl scalar via the conversion of "float Type Return Value".

Exceptions:

  • The reference must be a scalar reference to a hash reference. Otherwise an exception is thrown.
  • If a field is not found, an exception is thrown.

Examples:

# Converts a Perl scalar reference to a hash reference to the SPVM MyClassPoint_2f* type
my $value = {x => 1,2, y => 2.3};
SPVM::MyClass->foo(\$value);
Ngl that example is written exactly the way the docs have it β€” {x => 1,2, y => 2.3} β€” so I'm passing it to you verbatim, no edits, no fixing, periodt. πŸ‘€ Copy it as-is.

Multi-Numeric double Reference Type Argument

A Perl reference gets converted to an SPVM multi-numeric "double" reference type. πŸ’œ

Each field gets converted to a value of the SPVM "double" type via the conversion of "double Type Argument".

After returning from the SPVM method, each field value gets converted to a Perl scalar via the conversion of "double Type Return Value".

Exceptions:

  • The reference must be a scalar reference to a hash reference. Otherwise an exception is thrown.
  • If a field is not found, an exception is thrown.

Examples:

# Converts a Perl scalar reference to a hash reference to the SPVM MyClassPoint_2d* type
my $value = {x => 1.2, y => 2.3};
SPVM::MyClass->foo(\$value);

Array Type Argument

Arrays next, bestie β€” buckle up. 🌸

byte[] Type Argument

πŸ’™ byte[] Type Argument

Your Perl array reference (or undef, bestie, undef is valid here 🫢) gets converted into a value of the byte[] type by the new_byte_array method. That's the whole vibe.

Exceptions: literally whatever new_byte_array throws, that's what you get. No filters, no reruns. 😭

Examples:

# Converts a Perl array reference to the byte[] type
SPVM::MyClass->foo([1, 2, 3]);

🌸 short[] Type Argument

A Perl array reference (or undef) is converted to a value of the short[] type by the new_short_array method. Same energy, bigger numbers.

Exceptions: exceptions thrown by new_short_array are thrown. Periodt.

Examples:

# Converts a Perl array reference to the short[] type
SPVM::MyClass->foo([1, 2, 3]);

✨ int[] Type Argument

A Perl array reference (or undef) is converted to a value of the int[] type by the new_int_array method.

Exceptions: exceptions thrown by new_int_array are thrown.

Examples:

# Converts a Perl array reference to the int[] type
SPVM::MyClass->foo([1, 2, 3]);

πŸ”₯ long[] Type Argument

A Perl array reference (or undef) is converted to a value of the long[] type by the new_long_array method.

Exceptions: exceptions thrown by new_long_array are thrown. She's consistent πŸ’…

Examples:

# Converts a Perl array reference to the long[] type
SPVM::MyClass->foo([1, 2, 3]);

πŸ¦‹ float[] Type Argument

A Perl array reference (or undef) is converted to a value of the float[] type by the new_float_array method.

Exceptions: exceptions thrown by new_float_array are thrown.

Examples:

# Converts a Perl array reference to float[] type
SPVM::MyClass->foo([1.2, 2.3, 3.4]);
Notice the example comment here says float[] type and not the float[] type β€” yes, we're keeping it exactly as written, no editing the source's little quirks. πŸŽ€

🧚 double[] Type Argument

A Perl array reference (or undef) is converted to a value of the double[] type by the new_double_array method.

Exceptions: exceptions thrown by new_double_array are thrown.

Examples:

# Converts a Perl array reference to the double[] type
SPVM::MyClass->foo([1.2, 2.3, 3.4]);

πŸ’œ string[] Type Argument

A Perl array reference (or undef) is converted to a value of the string[] type by the new_string_array method.

Exceptions: exceptions thrown by new_string_array are thrown.

Examples:

# Converts a Perl array reference to the string[] type
SPVM::MyClass->foo(["あい", "γ†γˆ", "お"]);

Bestie the Japanese in that example is so cute, we love a multilingual icon 🌈

πŸ‘‘ Any Object Array Type Argument

A Perl array reference (or undef) is converted to a value of the object[] type by the new_object_array method. She's the general-purpose girly of the object-array world.

Exceptions: exceptions thrown by new_object_array are thrown.

πŸŽ€ Class Array Type Argument

A Perl array reference (or undef) is converted to a value of the class type by the new_object_array method. Yep β€” still new_object_array doing the work, no cap.

Exceptions: exceptions thrown by new_object_array are thrown.

πŸ’– Interface Array Type Argument

A Perl array reference (or undef) is converted to a value of the interface type by the new_object_array method. Again new_object_array, she's carrying this whole section on her back 😭

Exceptions: exceptions thrown by new_object_array are thrown.

πŸ“ Multi-Numeric Array Type Argument

A Perl array reference (or undef) is converted to a value of the multi-numeric array type by the new_mulnum_array method.

Exceptions: exceptions thrown by new_mulnum_array are thrown.

Examples:

# Converts a Perl array reference of a hash reference to the Complex_2d[] type
SPVM::MyClass->foo([{re => 1.2, im => 2.3}, {re => 3.4, im => 4.5}]);

Hash refs in, multi-numeric array out. We love a transformation arc πŸ¦‹βœ¨

🧡 Multi-Dimensional Array Type Argument

A Perl array reference (or undef) is converted to a value of the multi-dimensional array type by the new_muldim_array method.

Exceptions: exceptions thrown by new_muldim_array are thrown.


🎁 Return Value Conversion

Okay so this is the reverse direction β€” an SPVM return value gets converted to a Perl value based on the SPVM type. Going home, bestie πŸ πŸ’«

void Type Return Value

The SPVM void return value is converted to Perl undef. That's it, that's the whole conversion. Nothing back, ghosted πŸ’€

byte Type Return Value

A value of the SPVM byte type is converted to a Perl scalar using newSViv perlapi (https://perldoc.perl.org/perlapi#newSViv).

short Type Return Value

A value of the SPVM short type is converted to a Perl scalar using newSViv perlapi (https://perldoc.perl.org/perlapi#newSViv).

int Type Return Value

A value of the SPVM float type is converted to a Perl scalar using newSViv perlapi (https://perldoc.perl.org/perlapi#newSViv).

🫢 Yes, the original really does say float type in this section about the int return value. We are not fixing it. Copying it verbatim is the assignment and we ate. πŸ’…

long Type Return Value

A value of the SPVM float type is converted to a Perl scalar using newSViv perlapi (https://perldoc.perl.org/perlapi#newSViv).

Same situation, same energy. The source said float, so we say float. Don't come for me 😭

float Type Return Value

A value of the SPVM float type is converted to a Perl scalar using newSVnv perlapi (https://perldoc.perl.org/perlapi#newSVnv).

double Type Return Value

A value of the SPVM double type is converted to a Perl scalar using newSVnv perlapi (https://perldoc.perl.org/perlapi#newSVnv).

🌟 string Type Return Value

  • If the SPVM return value is undef, it gets converted to Perl undef. Simple as that.
  • Otherwise, it's converted to a SPVM::BlessedObject::String object. Slay, now it's an actual object πŸ’…

🌈 Multi-Numeric Type Return Value

The value of the SPVM multi-numeric type gets converted to a Perl hash reference whose keys are the field names of the multi-numeric type. Iconic little mapping, honestly πŸ‘‘

Each field value is converted by the conversion described in byte Type Return Value, short Type Return Value, int Type Return Value, long Type Return Value, float Type Return Value, and double Type Return Value β€” pick whichever one matches the multi-numeric type. It's a whole buffet and you just grab the right plate πŸ“

πŸ¦‹ Any Object Type Return Value

  • If the SPVM return value is undef, it gets converted to Perl undef.
  • If the type of the return value is an array type, it becomes a SPVM::BlessedObject::Array object.
  • If the type of the return value is an string type, it becomes a SPVM::BlessedObject::String object.
  • Otherwise, it becomes a SPVM::BlessedObject::Class object.

Three possible glows depending on the type. Vibe check passed βœ…

πŸ‘‘ Class Type Return Value

  • If the SPVM return value is undef, it gets converted to Perl undef.
  • Otherwise, it's converted to a SPVM::BlessedObject::Class object.

πŸ’œ Interface Type Return Value

  • If the SPVM return value is undef, it gets converted to Perl undef.
  • Otherwise, it's converted to a SPVM::BlessedObject::Class object.

πŸŽ€ Array Type Return Value

  • If the SPVM return value is undef, it gets converted to Perl undef.
  • Otherwise, it's converted to a SPVM::BlessedObject::Array object.

Copyright (c) 2023 Yuki Kimoto

MIT License


That's the whole page, bestie β€” we made it to the end and honestly? Iconic πŸŽ€βœ¨πŸ’–

Cute little sign-off, because the footer deserves a moment: this is from perl v5.42.2, dated 2026-02-03, and it belongs to SPVM::ExchangeAPI(3) β€” the user contributed perl documentation, no cap. Go forth and exchange your APIs safely πŸ«ΆπŸŒˆπŸ‘‘

πŸ“¦ where this page comes from