Page 1 of 1

Bug, er, somewhere...

Posted: Fri Aug 17, 2007 6:07 pm
by Jeff

Code: Select all

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

Posted: Fri Aug 17, 2007 9:11 pm
by Lutz
like this:

Code: Select all

(unless gs:listen (load "guiserver.lsp"))
tests if one of the gs funtions exists and refers to gs as a context.

Lutz

Posted: Fri Aug 17, 2007 9:16 pm
by Lutz
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 ...)

Posted: Fri Aug 17, 2007 10:41 pm
by Jeff
Thanks Lutz!