Skip to content

Instantly share code, notes, and snippets.

@zah
Created May 12, 2013 15:22
Show Gist options
  • Save zah/5563908 to your computer and use it in GitHub Desktop.
Save zah/5563908 to your computer and use it in GitHub Desktop.
# The key thing about the scheme is that stuff gets compiled on first usage
proc foo =
bar()
proc bar =
...
foo() # foo is compiled here (bar is already in scope so it's OK)
# -------------------------------------
# You can still forcefully produce an error like this:
# Note that the same will happen in every scripting language,
# hence scripting languages are good analogy to my scheme
foo() # first usage of foo: error, what is foo?
proc foo() = ...
# -------------------------------------
proc foo(x: int) = ...
template foo() =
proc bar = ...
foo() # foo is used here, so we need to examine all overloads at this point
# the template will be expanded and ``bar`` is registered
bar() # Ok, bar is already in scope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment