newLISP Fan Club

Forum => newLISP Graphics & Sound => Topic started by: Jeff on August 17, 2007, 11:07:24 AM

Title: Bug, er, somewhere...
Post by: Jeff on August 17, 2007, 11:07:24 AM
(unless (context? gs) (load "/path/to/guiserver.lsp")) ; => context expected in function set : gs

I understand what's happening... (context? gs) causes gs to get evaluated, setting the value of gs to nil.  Can contexts not be created in established variables?  It works if I delete the symbol after applying 'context? to it.



It's fine that contexts can't be created in existing symbols, but you can see how in the code above the behavior is counterintuitive.  However, if you are testing to see if something is, for example, a context vs an array or a list, you wouldn't want 'delete built into context?.  Hmmm.... not sure on the solution here (aside from something like (unless (context? gs) (and (delete 'gs) (load ...))).  Any ideas?
Title:
Post by: Lutz on August 17, 2007, 02:11:43 PM
like this:



(unless gs:listen (load "guiserver.lsp"))


tests if one of the gs funtions exists and refers to gs as a context.



Lutz
Title:
Post by: Lutz on August 17, 2007, 02:16:53 PM
The problem is in guiserver.lsp. There are (set 'gs:xxx ...) statements before the (context 'gs) statement. Move the (context 'gs) statement up before those. And (unless (context? gs) (load "....")) will work too.



Lutz



ps: right at the beginning after the long comment section. Move line 681 before 667 -> (set 'gs:black ...)
Title:
Post by: Jeff on August 17, 2007, 03:41:01 PM
Thanks Lutz!