Hi Pete, On Tue, 2004-01-13 at 16:41, peter royal wrote:
> lets leverage the map! the map knows if a variable exists. So how about > JexlExpression.setExplicitVariableDeclaration( true ); and then Jexl > just does (in ASTIdentifier, and I think that might be the only > place..) That would work. My only argument against it is that if someone adds another usage for JexlContext.getVars().get() then they might forget to add that check. So it's a maintenance issue. To be honest, I don't understand what ASTIdentifier does (not that it is opaque, just that I haven't explored yet). All I know is that there are 41 other implementations of SimpleNode.value(). (Yet) another solution: Get the JexlContext to track which variables it was asked for. Note which ones were known and which were not known. Then you can ask JexlContext for the list at the end. It's good because it doesn't break the API and it doesn't mean delving into Jexl to find all the places that it needs to be done in. It's not thread-safe. But, we can clone a JexlContext easily enough. How about: Expression.check(JexlContext); And the implementation looks *something* like: public String[] check(JexlContext context) { // Clone the context CheckingContext checkingContext = new CheckingContext(context); // Evaluate as normal evaluate(checkingContext); // Return the list of unknown variables return checkingContext.getUnknownVariables(); } Well, we can't be accused of being short of ideas! Not sure of the performance problems here - but I think, like XML parsing, people are happy to accept that if they want to be strict. - Bill --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]