The Java integration is very rudimentary at this point. It has a few restrictions:
int
, boolean
, String
Java
package de.slashbinbash.muckefuk;
public class TestClass {
public int value;
public static int testA(int a, int b) {
return a + b;
}
public TestClass(int value) {
this.value = value;
}
public void printValue() {
System.out.println(value);
}
}
Muckefuk
import("de.slashbinbash.muckefuk.TestClass");
# static method call
TestClass.testA(5, 10); # returns 15
# constructor call
obj = TestClass.new(42);
obj.printValue(); # prints 42
The std.Array
and std.Object
data structures are also implemented as Java classes that you have to import:
import("std.Object", "std.Array");
# create an object using the constructor concept
obj = Object { name:"Bob", age:42 };
arr = Array { 1, 2, 3, 4 };