Re: [O] noweb-ref: Limiting scope of definitions?

2012-02-01 Thread Eric Schulte
Yu yu_...@gmx.at writes:

 Hello!

 Scenario
 -

   * Maintain a potentially long org file as an appendix.
   * In this appendix, many independent scripting tasks will be documented.
   * Each such scripting task has similiar partial tasks, e.g. imports,
 settings, ...

 In such a case, many independent scripts may contain a block
 imports or something or something to the same effect, i.e. an
 overlap of definitions could be avoided only by some sort of scoping:
   (a) manually, e.g. by prefixing the names with a script-specific
 string (e.g. task1-imports. While this is flexible (i.e.
 allows reuse of code from other script), it also reduces the
 readability of the NOWEB code).
   (b) providing some sort of scoping, e.g. declaring definitions 
 section-local.


 Implementation Idea
 --

 A simple implementation, maintaining the flexibility of the manual
 solution, would be to create a header argument like :noweb-prefix,
 that effectively just adds a prefix to the noweb reference names (both
 in declaring the block (#+name, :noweb-ref) and in using it
 (name)), unless such a prefix is explicitly specified. This could
 then be set as needed, for specific blocks or subtrees (as property)
 or any mixture of such.

 A prefix would then be recognized by a delimiter string to be specified.

 This solution would also be downward compatible with existing files,
 as the syntax for recognizing a prefix would be relevant only when
 deciding whether to apply an explicitly introduced :noweb-prefix.


This does seem like a good idea and a header argument such as
:noweb-prefix is certainly the way to implement such functionality.

I'll add this to my long term stack.

Best,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



[O] noweb-ref: Limiting scope of definitions?

2012-01-30 Thread Yu
Hello!

Scenario
-

  * Maintain a potentially long org file as an appendix.
  * In this appendix, many independent scripting tasks will be documented.
  * Each such scripting task has similiar partial tasks, e.g. imports,
settings, ...

In such a case, many independent scripts may contain a block
imports or something or something to the same effect, i.e. an
overlap of definitions could be avoided only by some sort of scoping:
  (a) manually, e.g. by prefixing the names with a script-specific
string (e.g. task1-imports. While this is flexible (i.e.
allows reuse of code from other script), it also reduces the
readability of the NOWEB code).
  (b) providing some sort of scoping, e.g. declaring definitions section-local.


Implementation Idea
--

A simple implementation, maintaining the flexibility of the manual
solution, would be to create a header argument like :noweb-prefix,
that effectively just adds a prefix to the noweb reference names (both
in declaring the block (#+name, :noweb-ref) and in using it
(name)), unless such a prefix is explicitly specified. This could
then be set as needed, for specific blocks or subtrees (as property)
or any mixture of such.

A prefix would then be recognized by a delimiter string to be specified.

This solution would also be downward compatible with existing files,
as the syntax for recognizing a prefix would be relevant only when
deciding whether to apply an explicitly introduced :noweb-prefix.