On Nov 18, 2011, at 10:19 PM, andrea rossato wrote: > Sylvester Keil <[email protected]> writes: >> On Nov 17, 2011, at 10:37 PM, Rintze Zelle wrote: >>> I don't think we have ever discussed what the behavior of the >>> conditional should be in case of a suppressed variable, and I think a >>> case can be made for both choices. Assuming that suppressed variables >>> are "unset" in conditionals gives a bit more flexibility in coding >>> style logic, but ignoring suppression would make styles easier to >>> debug. >> >> If we are going to specify this, then it will be necessary to define >> when exactly a variable is substituted. Looking at the style in >> question, the first substitution is a text macro (!) called 'editor' – >> at what point should a processor decide which variable was used as a >> substitute? IMO the repression of substituted variables should be >> limited to a case like: >> >> <macro name="author"> >> <names variable="author"> >> <name/> >> <substitute> >> <names variable="editor"/> >> <text macro="title"/> >> </substitute> >> </names> >> </macro> >> >> Here it is immediately clear that the editor variable is used for the >> author variable; is it necessary to force the processor to expand >> nested macros to infer which variable was used as a substitute? Frank >> and Andrea seem taken the effort to implemented it this way, however, >> I wonder if that isn't too complicated. > > I implemented cs:substitute so to explicitly consume used variables. See > the function "consuming" in src/Text/CSL/Eval/Common.hs which, as you > may see, it does not expand nested macros, but forces the variable to > get a Value Empty after being used when evaluating a cs:substitute > element. > > In other words, variables are stored in a global state together with > another Boolean variable; when this is True retrieved variables are > immediately emptied. > >> Another issue I noticed: if editor is used as a substitute for author >> (and is subsequently repressed), I still think that the conditional >> check 'author or editor or translator' should equal true, because we do >> have one value: either the editor, or, if we say that editor is >> unset/repressed it follows that we now have a valid author value, >> because that's what editor was used for. > > I do not see it this way: author has no value and so a substitute, > *another* variable, is used instead. As a result, the act of using it > suppresses it, which means that the variable will return no value for > any other call in the cs:layout element.
>From the point of view of a style author, I would think that the condition, >does either of 'author', 'editor' or 'translator' exist should be true, even >if one of the variables was substituted by one of the others. Let's think >about it this way: to my understanding, the reason for the substitution is >that, given a style that would normally print both editor and author fields >there will be no duplication if one of the fields is missing and substituted >by the other one. However, that still means that one of the two fields >*exists* (it was just repressed from being printed a second time), so it seems >only logical to me that a condition that asks whether one or the other exists >should be true. Consistency is more complicated though. Because the conditional in question queried both variables in question, it is not so important which of them returns true, as long as one of them does. However, if we want full consistency then the substitution cannot repress a value from conditionals at all (i.e., what if the conditional queried only the author field or the editor field, but not both), *or* the cite processor would have to process the style in two-passes, using a first pass to make substitutions. I think this is altogether too complicated. Either suppression of variables should be applied only to printing of variables (not conditions), or it should be implemented like Andrea suggests, however, either the substitute or the variable that was substituted should be considered to exist after the substitution (leading to potentially inconsistent conditional results); it just does not make sense to me that suddenly both variables should be gone after the substitution. Sylvester ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ xbiblio-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/xbiblio-devel
