Stream: beginners

Topic: Question from GH - Mutation in Roc


view this post on Zulip Luke Boswell (Jul 05 2025 at 08:38):

https://github.com/roc-lang/roc/issues/7946

Roc has a lot of features I'm keen to try out. I'm also curious to know practical it is for dealing with linear algebra so I was wondering if vectors/matrices are supported?

My second question concerns how Roc deals with mutation. As I understand it, the optimisation allowing for in-place mutation relies on the mutated variable not being referenced to later in the program. In programs dealing with larfe matrices, it'd be very convenient to ensure that mutation is always in place, so are there any features of the language to prevent a variable from being re-used? For example Rust has the notion of ownership.

view this post on Zulip Kiryl Dziamura (Jul 05 2025 at 09:48):

I'm not sure roc would ever have an explicit linearity feature, but maybe it's possible to provide the info via lsp?

view this post on Zulip Anton (Jul 05 2025 at 09:53):

but maybe it's possible to provide the info via lsp?

Related older discussion: #ideas > assertUnique function. @ 💬

view this post on Zulip Anton (Jul 05 2025 at 09:53):

I have replied on the github issue

view this post on Zulip Brendan Hansknecht (Jul 05 2025 at 16:18):

Oh.... Now that we plan to have an interpreter, it is probably even easier to make a integrated tool that creates a report like scalene has. Essentially, report on, time, bytes copied, uniqueness failures, and such per line of code

view this post on Zulip Brendan Hansknecht (Jul 05 2025 at 16:18):

That will likely help a lot

view this post on Zulip Luke Boswell (Jul 06 2025 at 04:02):

Follow up question

Thanks for the quick answer! I note the explicit desire not to reproduce Rust's ownership system, is it for the sake of simplicity?

view this post on Zulip Brendan Hansknecht (Jul 06 2025 at 04:41):

I think yes is the answer


Last updated: Jul 06 2025 at 12:14 UTC