Created
May 12, 2013 15:22
-
-
Save zah/5563908 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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