On May 22, 2007, at 6:23 PM, yuping he wrote:
Hi, I have 2 questions:
I wonder whether you're writing a book or something -- you've been asking some awfully obscure questions!
why the global var runs but local var fails.
Do you remember a few years ago a news story about a scientist alone at a station in Antarctica who performed her own emergency appendectomy, because there was no doctor around and none could be there until it would be too late? That's kind of what you're asking Jess to do here: iterating through the variables in the local context from within Jess code is asking fiddle around with its own guts, and weird things are likely to happen.
This works in the your defglobal case because the defglobal exists before you create the Iterator. The Iterator is just the Iterator of the keySet of a java.util.HashMap. Creating a new variable invalidates the Iterator, giving you a ConcurrentModificationException. So with the defglobal version, since the variable holding the iterator is pre-existing, this works; in the local case, you create an iterator, then bind it to a new variable, immediately invalidating the iterator. If you created the local variable before the iterator, then it should work -- but there's really no reason why you should be writing code like this.
*********************************************Second Question***************************************************** Why when you importClass, static members of that class get imported. when importPackage, static members of classses inside that package are not imported
I think the answer here is "just because." It seemed to me the most sensible thing to do. I could have created another function or syntax to emulate Java 5's "import static", but I decided just to roll it into "import". Is this causing a problem for you?
--------------------------------------------------------- Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
