Stream: beginners

Topic: reference other expressions in record destructure failin


view this post on Zulip Oliver (Jan 30 2024 at 23:00):

Hello gain, the tutorial says this code will work:

{ height, width, title ? "", description ? Str.concat "A table called " title }

I wrote the following;

main = Stdout.line "$(table {height: 3, width: 2})"


table = \{height, width, title ? "", description ? Str.concat "Table name: " title} ->
  "Table: $(Num.toStr height) x $(Num.toStr width) $(description)"

and am getting this error:

── UNRECOGNIZED NAME in main.roc ───────────────────────────────────────────────

The #UserApp module does not expose anything by the name title.

────────────────────────────────────────────────────────────────────────────────

1 error and 0 warnings found in 185 ms.

any feedback as to what's going wrong?

view this post on Zulip Brendan Hansknecht (Jan 30 2024 at 23:08):

I'm pretty sure the tutorial is ahead of the language and we should remove that from the tutorial until we add the feature.

view this post on Zulip Oliver (Jan 30 2024 at 23:09):

Thank you for your swift response

view this post on Zulip Brendan Hansknecht (Jan 30 2024 at 23:16):

#6473


Last updated: Jul 06 2025 at 12:14 UTC