newlisp crashing in 'new' function

Started by itistoday, December 02, 2009, 06:42:01 PM

Previous topic - Next topic

itistoday

I've discovered an odd crash in newlisp 10.1.6 that's causing me grief:


(new Class 'Foo)
(context Foo)
(constant 'NEWLISP64 (not (zero? (& (sys-info -1) 256))))

; comment out the line below and it doesn't crash
(constant 'get-ptr (if NEWLISP64 get-long get-int))
(context MAIN)

(new Foo 'Bar) ; crash!


What's going on, why is it crashing?



To get around this I tried placing the constant declarations outside the context Foo by context-qualifying them to be in the Foo class:


(constant 'Foo:NEWLISP64 (not (zero? (& (sys-info -1) 256))))

But the function 'constant' won't let you do that (on a separate note, can that be changed too?).



Edit: this crash also happens if I use 'set' instead of 'constant'.
Get your Objective newLISP groove on.

Lutz

#1
this happens when doing 'new' on an alias built-in, in this case 'get-int/get-long'. This will be allowed in the next version.



As a workaround define the alias get-ptr in the MAIN level:


(constant 'NEWLISP64 (not (zero? (& (sys-info -1) 256))))
(constant 'get-ptr (if NEWLISP64 get-long get-int))

(context 'Foo)
; get-ptr is now known here as a global built-in
(context MAIN)

(new Foo 'Bar)

itistoday

#2
Thanks!
Get your Objective newLISP groove on.