| I just ran into an error with the order in which a set of functions were defined in my code. Here is an example of a simplistic REPL session that reproduces this error: arc> (def hello () (blankpage (pr "Hello world")))
#<procedure: hello>
arc> (mac blankpage body `(tag html (tag body ,@body)))
#3(tagged mac #<procedure>)
arc> (hello)
Hello world
Error: "Function call on inappropriate object #3(tagged mac #<procedure>) (\"Hello world\")"
arc> (def hello () (blankpage (pr "Hello world")))
*** redefining hello
#<procedure: hello>
arc> (hello)
<html><body>Hello world</body></html>"</"
arc>
So, it looks like Arc acts a bit like C in that all functions must defined before they are used. The compiler doesn't complain whenever you define a function that uses an, as yet, undefined function, but when you try to execute it, you'll get the "Function call on inappropriate object" error.Am I the only one that has run into this problem, and if so, am I just doing something wrong here or is this actually an error that needs fixing? |