Stream: beginners

Topic: Is forking a platform the only way to do rust FFI?


view this post on Zulip Asbjørn Olling (Dec 04 2023 at 19:02):

So if multiple platforms are't a thing...

Hypothetically speaking, how would I do FFI from roc code an existing rust library?

Is the only way to fork a platform?

I'm vaguely aware that there has been and idea for something like platform plug-ins? But that's.. not a thing? right?

superfluous details about my use-case

view this post on Zulip Brendan Hansknecht (Dec 04 2023 at 19:06):

Is the only way to fork a platform?

If you truly need ffi to an arbitrary library either:

view this post on Zulip Brendan Hansknecht (Dec 04 2023 at 19:09):

Does that seem like a reasonable way to go?

Yep. Fork, add matrix library. Maybe trim some unneeded stuff or customize the platform otherwise. Then build on that.

view this post on Zulip Asbjørn Olling (Dec 04 2023 at 19:23):

Coolcool. I might give that a shot one day. Thanks.

view this post on Zulip LoipesMas (Dec 04 2023 at 19:46):

I still have a limited understanding of platforms, but I think that having to do matrix-bot platform is actually a good thing. Because you could set it up so that the Roc code just provides callbacks for the hooks (and some configuration probably? or maybe just a path to a file and the platform will handle that) and the platform would handle setup, connecting to the server, setting callbacks. So the platform would be like a framework, exposing only what's needed. Is this the idea?

view this post on Zulip Brendan Hansknecht (Dec 04 2023 at 19:49):

100% that is the idea.

view this post on Zulip Brendan Hansknecht (Dec 04 2023 at 19:49):

That would be an amazingly well scope platform that would hopefully expose a really nice and focused matrix related api

view this post on Zulip Asbjørn Olling (Dec 04 2023 at 20:14):

Huh that's a cool idea. I haven't thought much about the API of a matrix platform, I guess I was figuring it'd be a lot of request/response managed effects / a lot of generic Task stuff, that should just map directly to the types and functions in matrix-rust-sdk.
Thinking about where platform/application boundaries are drawn is super interesting.
I really like the idea of a high-level Matrix bot platform.


Last updated: Jul 06 2025 at 12:14 UTC