this is really cool: the Ruby interop example now uses JSON as a quick-and-dirty way to send arbitrary values between Roc and Ruby:
main
that takes a type that can be decoded, and returns a type that can be encoded, and I'll take care of the restmain
argument and return value can be pretty much any Roc type that doesn't contain a function (since those can't be serialized as JSON) - like in this example where I arbitrarily decided on U64 -> Str
shoutout to @Ayaz Hafiz for getting the "automatic JSON encoding and decoding" working that facilitates this!
we can make a fancier platform in the future which supports going directly to Ruby types without the JSON intermediary, and which can support sending functions to Ruby and so on...but this gets a ton of the way there, and it only took me a few minutes to change from sending strings to Ruby to sending automatically serialized near-arbitrary Roc types via JSON!
So for the extra cost of encoding and decoding you get a super flexible API
..that's really cool
wow, and this works without any compiler panics??
yup!
we're getting really good at this programming language thing
granted, a proper glue implementation would be faster, and more flexible...and probably take more like a week of work :big_smile:
Last updated: Jul 06 2025 at 12:14 UTC