SPVM improved Exchange API at v0.9684. Welcome to this easy world of type conversion!
Yuki Kimoto
Posted on January 24, 2023
SPVM improved Exchange API at v0.9684.
What is the Exchange API? It is a method for converting Perl data structures and SPVM data structures to each other.
SPVM is a statically typed language. Have you ever thought about the difficulties in passing an array of strings to a statically typed language?
Sounds easy? Please try it, this difficulty will be harder than you think. Strings are not just numbers. It must be dynamically allocated in memory. And when it comes to arrays, you need to allocate memory for the array, allocate memory for multiple strings, and assign them to the array. And finally, multiple strings must be deallocated and the array must be freed.
How many lines does this take? What happens if we repeat this over and over? More mistakes. More copy and paste. Your brain will get bored with the same thing over and over again.
# SPVM
class MyClass {
static method foo ($strings : string[]) { ... }
}
# Perl
SPVM::MyClass->foo(["aaa", "bbb", "ccc"]);
So you do not have to think about anything. Just pass the Perl string array reference as is.
This is just one example, but there are many automatic type conversions and methods that support conversions.
This is just one example, but there are many automatic type conversions and methods available in the Exchange API to support conversions.
Why don't you take a step into the world of SPVM's easy type conversion? The ease of type conversion will change the value of interactions between statically and dynamically typed languages.
Posted on January 24, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
January 24, 2023