newlisp crashing in 'new' function

Notices and updates
Locked
itistoday
Posts: 429
Joined: Sun Dec 02, 2007 5:10 pm
Contact:

newlisp crashing in 'new' function

Post by itistoday »

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

Code: Select all

(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:

Code: Select all

(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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: newlisp crashing in 'new' function

Post by Lutz »

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:

Code: Select all

(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
Posts: 429
Joined: Sun Dec 02, 2007 5:10 pm
Contact:

Re: newlisp crashing in 'new' function

Post by itistoday »

Thanks!
Get your Objective newLISP groove on.

Locked