You are browsing as a guest. Sign up (or log in) to start making projects!

5h 0m 35s logged

MORE FUCKING ABSTRACTIONS!!!

I added receiver/extension functions. These allow you to write code that takes in a type as a special argument
You define them just like how it works in kotlin:

warp <T, R> R T.let((T) -> R action) {
    return action(this);
}

It just compiles to a regular function

warp <T, R> R let(T this, (T) -> R action) {
    return action(this);
}

But the compiler lets you call it with the special argument:

thing.let((int a) -> ...);

I also added a very big standard library module (written in scratcher!) with a ton of these functions built-in, they allow you to write more expressive code:

triangles
     .filterNotNull()
     .filter((Triangle<float> t) -> t.x1 > 150)
     .filter((Triangle<float> t) -> t.y1 < 150)
     .forEach((Triangle<float> tri) -> ...)

I also rewrote the entirety of string lib during this, now you have to use the extensions library to use strings, but its way more powerful (and written in scratcher)!
I also added a new “char” type, which stores a single character (wow really???)
I also added “safe dot calls” that allow you to use stuff as if they’re not null:

triangles.forEach((Triangle<float>? t) -> {
    t?.x1?.let((float x1) -> {
        looks::say("x1: ${x1}");    
    });
});

This only calls the let function if t?.x1 is not null

There is a big problem with all this powerful new code though… the garbage collector can no longer keep up, a single mark and sweep takes over 1 second! Which is especially bad because the garbage collector needs the entire application to stop in order to run. You do not want your code to completely stop for a whole second(maybe you do? weirdo), so I have to fix this in my next few devlogs…

0
42

Comments 0

No comments yet. Be the first!