From: Ethan A M. <merritt@u.washington.edu> - 2004-07-18 23:14:16
|
> So far, variables stored values, not expressions to be evaluated at > some later time. If at all possible, I'ld like to keep it that way for > strings, if only to minimize the amount of documentation we and the users > will need to fully explain all this. I disagree, and I think the record of requests for enhancement support me on this point. People really want a way of embedding variables into strings, and having the current value of the variable substituted in at the time the string is printed. It doesn't matter whether you call that "re-evaluation of a string" or "storing a function instead of a string", or "storing an expression to be evaluated later", that is the desired capability. > I'm opposed to having sprintf() *inside* the quotes. It causes new > problems like the '' vs. "" saving issue that we don't really need, for no > real gain. On the contrary, it's a huge gain. It means that a very powerful ability is introduced in a uniform way, yet requires minimal or no change to the existing code or to the existing storage mechanisms for strings. Anything you do _outside_ the quotes means that every single place that tests for a string constant has to be re-written to handle the possible substitution of other syntactic entities instead. But let me repeat again, I do not care what the exact quoting style is. If it saves confusion, I'm perfectly happy to add a 3rd quote character besides ' and ", and reserve this new quote character for the case of re-evaluation at plot time. That would require changing is_quote(), which is easy, and a lot of places that explicitly test for ' or ", which is more annoying but certainly doable. Assume for the moment we use % for this purpose. Then the documentation would read: "<expression>" evaluate immediately, with substitution '<expression>' evaluate immediately, no substitution %<expression>% evaluate later, with substitution at that time -- Ethan A Merritt Department of Biochemistry & Biomolecular Structure Center University of Washington, Seattle |