Stream: beginners

Topic: Interop without Effect?


view this post on Zulip Jared Cone (Mar 11 2022 at 23:40):

Is it possible, or are there any plans to make it possible, to call a platform function from Roc that doesn't return an Effect? Like, being able to call some pure function in Rust to do some calculation?

view this post on Zulip Richard Feldman (Mar 11 2022 at 23:53):

the current plan is to never make this possible

view this post on Zulip Richard Feldman (Mar 11 2022 at 23:55):

it seems impossible in the general case to be able to verify that it's actually pure (doing it for wasm seems the most plausible, but even there it would need so many restrictions it's probably not worth the effort it would take because it would accept so few programs anyway) and if we can't be sure it's pure, we can't accept it

view this post on Zulip Jared Cone (Mar 12 2022 at 00:24):

Somewhat related, I'm trying to diagnose a bug that's like 5 levels deep in a callstack. Is there any way I could throw in a log statement without having to convert all 5 functions to returning Task?

view this post on Zulip Richard Feldman (Mar 12 2022 at 00:24):

not yet, unfortunately :sweat_smile:

view this post on Zulip Richard Feldman (Mar 12 2022 at 00:25):

a way to do that is still on the TODO list!

view this post on Zulip Kevin Gillette (Mar 13 2022 at 15:01):

logging for debugging is convenient, yeah, but if we're going that route, a builtin debugger would be nicer (conditionally compiled in, of course), such that a debug function will set a breakpoint and enter an interactive, guided debugger if the environment supports it (stdin is a tty, or the editor wires up ipc), or logging variables and stack trace when the debugger cannot be used.

view this post on Zulip Kevin Gillette (Mar 13 2022 at 15:04):

or alternatively the ability to capture sufficient platform inputs in the call chain to allow for a state file to be dumped and interactive tracing or "what if" exploration to happen after the fact, with the ability to record those explorations so that they can be revisited later, tried against updated code, etc

view this post on Zulip Jared Cone (Mar 13 2022 at 15:43):

Being able to log to a debugger is a good idea. Sometimes in my work tho I need to log when I'm unable to attach a debugger (debugging multiple interactive processes working together, debugging a deployed/remote process)

view this post on Zulip Richard Feldman (Mar 13 2022 at 15:45):

oh yeah we definitely want the editor to have really nice debugging capabilities!


Last updated: Jul 06 2025 at 12:14 UTC