I've noticed the below enables the use of dbg inline. Is this something we could add as syntax sugar or as a builtin maybe?
I'm not sure what the longer term plan is to support this use-case, maybe this is too hacky or sets us up for a bad time later?
debug = \v ->
dbg v
v
I think that’s already the plan: https://roc.zulipchat.com/#narrow/stream/316715-contributing/topic/auto-derived.20Inspect/near/404760322
Basically making dbg both a statement and valid expression
yeah the code gen is easy; I think the only thing that needs to happen is to look for the dbg keyword both in the statement position and also in the expression position, and make sure it generates code differently depending on which one it was parsed as
if anyone wants to implement that lmk! I'd be happy to mentor :smiley:
I'm interested in implementing but my time is still spotty so if someone else wants it done in the next couple weeks they should go for it
and make sure it generates code differently depending on which one it was parsed as
I'm not sure how difficult the above task is, but something I've proposed before in the related issue is to start with dbge for the expression case and merge dbg and dbge later.
Last updated: Jun 16 2026 at 16:19 UTC