--- Begin Message ---
Subject: |
Re: @NoCite Problem |
Date: |
Wed, 9 Dec 1998 05:42:47 +0300 |
Hi, Dominikus.
On Tue, Dec 08, 1998 at 07:48:35AM +0100, Dominikus Herzberg wrote:
> I think there is a minor bug in the definition of @NoCite (Lout 3.12), see
> the problem described.
Subtle a bug indeed.
> But if I change @Cite to @NoCite in the example the result is an "unordered"
> list; it looks like this:
>
> Balzert (1996b)
> Balzert (1998)
> Balzert (1996a)
>
> @Tag { MOOSA }
> @Annote { 1996a }
> @Tag { SWT1 }
> @Annote { 1996b }
> @Tag { SWT2 }
> @Annote { 1998 }
Check lout.li file and you'll see that keys for SWT1 and SWT2 dont'
have comma in author's name, while an entry for MOOSA has, so MOOSA
sorts last. Also note that printed references for SWT* has no commas
where they have them in the database.
The tricky question is where that comma is?! WLOG, let's consider the
problem with sort key.
Running lout with -ddcr -ddst -ddsu -ddce -ddom is instructive (though
prepare yourself for few megs of trace).
Note the following line (formatted to fit better)
ce: AttachEnv(
<@Author<@RefListSortKey<@SortKey<@Key<@SendRef<@NoRef<@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>>>>>>
<@SortKey<@Key<@SendRef<@NoRef<@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>>>>>>,
@Reference
@Tag { "SWT""1" }
@Label { "Balzert" }
@Annote { "1" ++5++ "b" }
@Type { "Book" }
@Title { "Lehrbuch" ++4++ "Software" ++3++ "Entwicklung" }
@Author { "Balzert" ,"Helmut" }
@Publisher { "Spektrum" ++3++ "Verlag" }
@Address { "Heidelberg" , ++3++ "Oxford" }
@Year { "1" ++4++ "6" } )
Note that comma in @Author is NOT QUOTED - so its a symbol name, not a
literal word. The chain of environments suggests that it comes from a
@NoCite, where it's defined like
def "," precedence 90 left x { x }
Now compare this with the trace for this same document, but this time
the tag in the @NoCite quoted (i.e. @NoCite{$"SWT1"}):
The corresponding line from the trace will now look:
ce: AttachEnv(
<@Author<@RefListSortKey<@SortKey<@DocumentLayout<>>>>
<@SortKey<@DocumentLayout<>>>>,
@Reference
@Tag { "SWT""1" }
@Label { "Balzert" }
@Annote { "1" ++5++ "b" }
@Type { "Book" }
@Title { "Lehrbuch" ++4++ "Software" ++3++ "Entwicklung" }
@Author { "Balzert" ++3++ "Helmut" }
@Publisher { "Spektrum" ++3++ "Verlag" }
@Address { "Heidelberg" ++4++ "Oxford" }
@Year { "1" ++4++ "6" } )
Note how the chain of envs is much shorter and it doesn't contain the
@NoCite with it's internal definition for comma.
Let's check where the two cases (juxtaposed and quoted) depart.
Quoted case has (abridged):
om: [Manifest(closure @NoCite { @NoRef "SWT1" } )
om: environment: <@Text<@OrdinaryLayout<@DocumentLayout<>>>>
om: [Manifest(closure cite )
om: environment: <@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>
om: [Manifest(closure @NoRef "SWT1" )
om: environment: <@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>
om: [ manifesting closure @NoRef
ce: SearchEnv(<@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>,
@DocumentLayout)
ce: SearchEnv returning @DocumentLayout @InitialBreak { "ragged" ++3++
"nohyphen" } @PageType { "Other" } @PageWidth { "8" ++3++ "s" }
@PageHeight { "6" ++3++ "f" } @TopMargin { "1""f" } @FootMargin { "1""f" }
@MakeReferences { "Yes" } @RefCiteLabels { @Label"("@Annote }
@RefCiteStyle { cite")" } @RefListFormat { "DropLabels" } @RefListLabels {
@Label"(" ++3++ ")" } @RefListSortKey { @Author ++3++ @Annote }
ce: calling ClosureExpand from Manifest/CLOSURE
ce: ClosureExpand( @NoRef "SWT1", <@DocumentLayout<>>, TRUE, crs, res_env )
ce: AttachEnv( <@DocumentLayout<>>, @NoRef "SWT1" )
ce: AttachEnv returning.
ce: SetEnv( x, <nilobj> ), x =
@NoRef "SWT1"
ce: SetEnv returning <@NoRef<@DocumentLayout<>>>
Juxtaposed case has:
om: [Manifest(closure @NoCite { @NoRef "SWT""1" } )
om: environment: <@Text<@OrdinaryLayout<@DocumentLayout<>>>>
om: [Manifest(closure cite )
om: environment: <@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>
om: [Manifest(closure @NoRef "SWT""1" )
om: environment: <@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>
om: [ manifesting closure @NoRef
ce: calling ClosureExpand from Manifest/CLOSURE
ce: ClosureExpand( @NoRef "SWT""1",
<@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>, TRUE, crs, res_env )
ce: AttachEnv( <@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>, @NoRef
"SWT""1" )
ce: AttachEnv returning.
ce: SetEnv( x, <nilobj> ), x =
@NoRef "SWT""1"
ce: SetEnv returning
<@NoRef<@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>>
Which correspond to the following code in ManifestCl (z08.c):
/* now check z to see whether it is either a word or and ACAT of words */
if( !is_word(type(z)) )
{ symbol_free = FALSE;
}
}
/* if all parameters are free of symbols, optimize environment */
if( symbol_free && imports(sym) == nilobj && enclosing(sym) != StartSym )
For the juxtaposed case (not is_word) this optimization fails.
Ordinary refs work since comma is defined as left x { x"," } in @Cite,
so this compensates for the wrong environment.
But in @NoCite comma defined to be left x { x }, so that user coould
write @NoCite{$ref1,$ref2,$ref3} and this definition of comma is
picked up by @Reference.
This seems definetly wrong to me. @Reference should not be affected
by internal definitions of @Cite/@NoCite
It seems that Lout confuses environment for the right parameter to
@NoCite and environment for a call to @NoRef.
@NoCite { $NoRef SWT1 }
^^^^^^^^^^^^^^^
This is body parameter, so it needs access to @NoCite internals (as
well as @Text's and so on, unwinding bodies). But
def @NoCite body x { @NoRef x }
^^^^^^^^^^^^
this is lexically scoped so don't need to unwind the bodily chain.
Perhaps Jeff has more to say on this.
SY, Uwe
--
address@hidden | Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/ | Ist zu Grunde gehen
--- End Message ---