|
From: Juergen W. <wie...@fr...> - 2005-06-29 10:49:11
|
Ethan Merritt wrote: > I will consolidate the (isstring() || isstringvar()) test into a single > call isstringvalue(). This simplifies the code, which is good. > If/when Juergen comes up with a fully working isstringfunc(), that can be > added at a single point in isstringvalue(). This is tricky. The functions isstring() and isstringvar() only check the next token if it is/contains a string. The current syntax implies that the whole expression has to be a string then. A call to isstring() and isstringvar() is thus safe. A function isstringfunc() will have to evaluate the whole expression. This should only be tried if we know that the syntax requires an expression. Such a function must not be called if the next token can be a key word. An invalid expression would lead to an int_error(). Theoretically, this could be implemented. But it means that all command line parsing would have to check for key words *before* the call to isstringfunc() [or an extended isstring()]. All call sites in the sources would have to be checked and quite few would have to be rewritten if they were to use isstringfunc(). BTW: I wouldn't like to evaluate an expression and to throw away everything but the type of the result. The function try_to_get_string() seems more appropriate in the cases where isstringfunc() can be used. > By my current count there are 14 of these consolidated tests, > as compareded to ~60 remaining instances of the original isstring(). > > So I agree with you in principle, but let's get the simplified code > checked out first before considering a grand re-naming. Juergen |