roc-lang / roc

A fast, friendly, functional language.

Home Page:https://roc-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Variable can be used before it is defined

dykstrom opened this issue · comments

This example program builds and runs fine, even though variable "bar" is undefined when it is used.

I am using roc nightly pre-release, built from commit 3abc276 on Fri Jul 5 09:11:06 UTC 2024.
Operating system: macOS.

app [main] {
    cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.11.0/SY4WWMhWQ9NvQgvIthcv15AUeA7rAIJHAHgiaSHGhdY.tar.br",
}

import cli.Stdout

foo = \value -> value

main =
    x = foo bar
    bar = 17
    Stdout.line! "Value: $(Num.toStr x)"