2008-06-12

More on identifiers

Since I've been blogging on identifiers something came to my mind. There are absolute identifiers (for Chapters and Sections) and relative ones (for paragraphs). The syntax should reflect this. What about :
  \\absolute-identifier

  \relative-identifier
The reverse solidus (well-known of Windows users) is convenient for expressing path-like structures, while not conflicting with the solidus used in URLs. A relative identifier requires an absolute identifier. For a Part like this:
== Section
  \\section-identifier

  \paragraph-identifier-1
Blah. 

  \paragraph-identifier-2
Blah blah. 

  \paragraph-identifier-3
Blah blah blah. 

Here is a valid reference to the paragraph:
\\section-identifier\paragraph-identifier
The absolute identifier may be carried by the context. As described in the Book post, only some Paragraphs in a Section may be included so referencing the Section is a way to define such a context.
expand \\section-identifier
  \paragraph-identifier-1
  \paragraph-identifier-3
Ok the syntax has slightly evolved since but you get the idea. The reverse-solidus based notation looks good to me. Double path separator for an absolute path is a well-known pattern (URL spec). I like the idea to ask a bit more work for an absolute identifier as they should be used carefully, in order to avoid global namespace pollution. With that syntax we now support an uniform relationship model between Chapters, Sections and Paragraphs.

No comments: