SPVM 0.9014 Release - add class, method, static keyword, omit SPVM:: namespace

I release SPVM 0.9014. Latest releases have some big changes.

add class, method, static keyword, omit SPVM:: namespace, and remove sub, self, keyword.

Before

# lib/SPVM/Point.spvm
package SPVM::Point {
  has x : int;
  has y : int;

sub new : SPVM::Point () {
return new SPVM::Point;
}

sub clear : void ($self : self) {
$self->{x} = 0;
$self->{y} = 0;
}
}

After

# lib/SPVM/Point.spvm
class Point {
  has x : int;
  has y : int;

static method new : Point () {
return new Point;
}

method clear : void () {
$self->{x} = 0;
$self->{y} = 0;
}
}


I imagine Moo, hash references, Mojo::Base, Object::Pad, Cor, etc. when choosing SPVM syntax.


See SPVM more Examples

Leave a comment

About Yuki Kimoto

user-pic I'm Perl Programmer. I LOVE Perl. I want to contribute Perl community and Perl users.