Bug #1: context? reporting true for non-context
Code: Select all
> (new-class 'Foo)
Foo
> (setf f (instantiate Foo))
Foo#1
> (deallocate f)
true
> (context? f)
true
> (symbols f)
ERR: context expected in function symbols : f
Bug #2: Memory leak
For this one ObjNL.lsp is also needed, simply because it's much easier to demonstrate the leak by using auto-release pools:
Code: Select all
> (new-class 'Foo)
Foo
> (define (inflate-memory) (push-autorelease-pool) (dotimes (_ 10000) (autorelease (instantiate Foo))) (pop-autorelease-pool))
(lambda () (push-autorelease-pool)
(dotimes (_ 10000)
(autorelease (instantiate Foo)))
(pop-autorelease-pool))
> (inflate-memory)
true
> (inflate-memory)
true
Bug #3: nil? evaluates its argument twice
This one is quite significant:
Code: Select all
> (nil? (inc a))
nil
> a
2
Take a look at this REPL session:
Code: Select all
> [cmd]
(define-macro (epln what)
(when (nil? (println "\n" what "\n -> " (eval what)))
(exit)
)
)[/cmd]
[/cmd]
(lambda-macro (what)
(when (nil? (println "\n" what "\n -> " (eval what)))
(exit)))
nil
Note the 'nil' at the very end. This shows that newLISP is evaluating something... Here's a bizarre variant that shows some more insight to the problem:
Code: Select all
> [cmd](define-macro (epln what)
(when (nil? (println "\n" what "\n -> " (eval what)))
(exit)
)
)[/cmd]
[/cmd]
nil
-> nil
macbookpro:~$