How to combine @send and @new

Hi,

I’m a situation where I need to create bindings for the following:

import kaplay from "kaplay";
let k = kaplay()
let v = new k.Vec2(2,3)

This sorta both needs @send and @new, but that leads to You used a FFI attribute that can't be used with @send.

How do I work around this?

1 Like

Ended up using

let mathRect: (t, Vec2.t, int, int) => Math.Shape.t = %raw(`
function (k, pos, width, height) {
    return new k.Rect(pos, width, height);
}
`)
1 Like

Feels like something that should be supported.

2 Likes