Closed feste closed 11 years ago
For reference, this is broken because it still uses the mapped name as a definition, e.g.
(define + 1)
is compiled to
var church_builtins.plus = 1
This used to work when builtins weren't in a namespace, so it would just be
var plus = 1
I think we can easily fix this by detecting builtin names and not making them VariableDeclaration but an assignment, so we have
church_builtins.plus = 1
i fixed a bunch of these in 56e6a2ab27a4c70af7b8af4744065854d61ae420. didn't fix the assignment to builtins thing, since its a pain.
btw. why are builtins in a separate object?
I put them in a separate object to remove the possibility of collision, especially with ProbJS builtins and the runtime environment.
Fixed in 8471514275614a082cf4f4dd16bd78b2524af10b, introduced bug tracked in #42
Error "Cannot read property 'text' of undefined" for mistakes like:
trying to redefine a builtin function: (define fold 'hi)
trying to give a builtin function the wrong argument types: (mean third '(1 2 3)) (+ flip 1) (+ 'hi)
trying to give a builtin function too few arguments: (mean)