Not Switching Contexts and a Constant Question
Posted: Sat Feb 06, 2010 2:50 am
I noticed while using net-eval that context doesn't actually switch the context:
This is similar to what happens when using eval in the following way:
Also, shouldn't constant work like set in the following example?
If you want to use constants for named indexes (a good idea), then you're forced to define your class within a context. This is a must for large, complex classes, but for simple classes, I like the minimalism of defining within the MAIN context.
m i c h a e l
Code: Select all
> (net-eval "localhost" 4711 "(context 'C)" 1000)
C
> (net-eval "localhost" 4711 "(context)" 1000)
MAIN
> _
Code: Select all
> (dolist (ea '((context 'C) (constant 'v 8) (context MAIN))) (eval ea))
ERR: symbol not in current context in function constant : MAIN:v
> _
Code: Select all
> (new Class 'Thing)
Thing
> (set 'Thing:attribute 1)
1
> (constant 'Thing:attribute 1)
ERR: symbol not in current context in function constant : Thing:it
> _
m i c h a e l