Stream: beginners

Topic: New compiler: multiline strings


view this post on Zulip Aurélien Geron (Dec 03 2025 at 03:00):

Are multiline strings supported yet?

This code runs but prints nothing:

app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.1-test/7iDKk44no3gF9Nrh2VyF8Y5yvy1jUBhrbhHURN1WQptB.tar.zst" }

import pf.Stdout

data =
    """
    This is a multiline
    string.
    """


main! = |_args| {
    Stdout.line!(data)
    Ok({})
}

For what it's worth, I initially got a compiler crash when the multiline string was too long (4000+ lines = my AoC day 1 input), and no output when the string was shorter. But then I recompiled the compiler and there's no longer a compiler crash, just no output.

view this post on Zulip Richard Feldman (Dec 03 2025 at 03:09):

yes, we changed the syntax - now it's

data =
    \\This is a multiline
    \\string.

view this post on Zulip Richard Feldman (Dec 03 2025 at 03:10):

(same as Zig's syntax)

view this post on Zulip Aurélien Geron (Dec 03 2025 at 03:10):

Oh cool, like in Zig, love it.

view this post on Zulip Aurélien Geron (Dec 03 2025 at 03:10):

Perhaps using """ should give a helpful warning / error

view this post on Zulip Aurélien Geron (Dec 03 2025 at 03:13):

Fixed. However, although the program runs normally now, it ends with:

error(gpa): memory address 0x103200000 leaked:
Unable to print stack trace: Unable to open debug info: MissingDebugInfo

view this post on Zulip Aurélien Geron (Dec 03 2025 at 03:20):

I'm trying to print the number of bytes in my input string:

[...]
main! = |_args| {
    bytes = data.to_utf8()
    len = bytes.len()
    output = len.to_str()
    Stdout.line!(output)
    Ok({})
}

I get this runtime error:

thread 37216187 panic: incorrect alignment
???:?:?: 0x102a59233 in ??? (roc_run_994723065)
???:?:?: 0x102959e63 in ??? (roc_run_994723065)
???:?:?: 0x10290a7a3 in ??? (roc_run_994723065)
???:?:?: 0x1028e1d1f in ??? (roc_run_994723065)
???:?:?: 0x1028df6a7 in ??? (roc_run_994723065)
???:?:?: 0x1028df10b in ??? (roc_run_994723065)
???:?:?: 0x1028d8913 in ??? (roc_run_994723065)
???:?:?: 0x19fd42b97 in ??? (???)
???:?:?: 0x0 in ??? (???)
error: Child process /Users/ageron/Library/Caches/roc/73212f0613ff7600bbf5b003b36e3cfa/temp/roc-tmp-EMJa9WuLIKioAEl7KAWvrpfkyRJeNXN3/roc_run_994723065 killed by signal: 6
error: Child process aborted (SIGABRT)

view this post on Zulip Luke Boswell (Dec 03 2025 at 03:20):

Can you please share the full .roc code that does that

view this post on Zulip Luke Boswell (Dec 03 2025 at 03:20):

Which platform URL are you using

view this post on Zulip Luke Boswell (Dec 03 2025 at 03:21):

This is the latest (v 0.3) I just pushed earlier today

https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.3/98T93wthPgoBRLYtPTT4RBBsQunrfDG94gihPf1zYYmE.tar.zst

view this post on Zulip Aurélien Geron (Dec 03 2025 at 03:22):

Sure, same as above:

app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.1-test/7iDKk44no3gF9Nrh2VyF8Y5yvy1jUBhrbhHURN1WQptB.tar.zst" }

import pf.Stdout

data =
    \\L4
    \\R49
    \\ ... (very long, 4000+ lines) ...


main! = |_args| {
    bytes = data.to_utf8()
    len = bytes.len()
    output = len.to_str()
    Stdout.line!(output)
    Ok({})
}

view this post on Zulip Aurélien Geron (Dec 03 2025 at 03:22):

Oh ok, thanks, I'll give this a try

view this post on Zulip Aurélien Geron (Dec 03 2025 at 03:23):

Yes, this fixed the issue, thanks! There's still a memory leak though, but at least the program runs normally:

4373823488
error(gpa): memory address 0x104d20000 leaked:
Unable to print stack trace: Unable to open debug info: MissingDebugInfo

view this post on Zulip Luke Boswell (Dec 03 2025 at 03:24):

Could you upload the full .roc file somewhere so I can hunt down the leak

view this post on Zulip Aurélien Geron (Dec 03 2025 at 03:26):

Sure:
https://gist.github.com/ageron/1f8fc1e302d772b23c2a5acc3b800f40

view this post on Zulip Luke Boswell (Dec 03 2025 at 04:01):

Fixed in https://github.com/roc-lang/roc/pull/8552

view this post on Zulip Aurélien Geron (Dec 03 2025 at 04:01):

Cool, thanks @Luke Boswell

view this post on Zulip Anton (Dec 03 2025 at 09:33):

fyi I have a branch that fixes the ??? in the traces but I still need to review it thoroughly.


Last updated: Dec 21 2025 at 12:15 UTC