[NTG-context] Modules, namespaces, Luacode etc..

Jaroslav Hajtmar hajtmar at gyza.cz
Fri Oct 1 09:51:09 CEST 2010


Thanx Wolfgang
puzzle starts to fit itself ...
Jarda




Dne 30.9.2010 20:53, Wolfgang Schuster napsal(a):
> Am 30.09.2010 um 20:40 schrieb Jaroslav Hajtmar:
>
>    
>> Hello my wise masters of the Force and teachers of Jedi...
>>
>> It seems that my first module (SCANCSV of scancsv.lua library of CTM in Brejlov) work without any visible errors (without
>> documentation and with a junkyard yet), but I'm not sure whether is there a
>> hidden problem or future collisions. Therefore I have a few of questions for
>> modules namespaces, luacode namespaces etc. I want to ask how relates a namespace ConTeXt module with
>> namespace of Lua code, which is listed within this module and others questions.
>>
>> 1. Is the namespace of Lua code independent of the namespace module?
>>      
> Yes.
>
>    
>> 2. If are ConTeXt macros defined in the module, are automatically in its namespace?
>>      
> No, the namespace in a module is only for keys and key-value-lists. When you write a command with the same name as a core command the core definition is overwritten and lost.
>
>    
>> 3. Can both namespaces (module and Luacode) somehow connected?
>>      
> You can try to use the same namespace in TeX and Lua but thats up to you.
>
>    
>> 4. What happens when I have two macros with the same name in two different modules?
>>      
> The last definition is the current meaning of the command, e.g. in this example the command \befehl has the content “Befehl” because it’s the last defintion.
>
> \def\befehl{command} % \befehl has not the content “command”
>
> \def\befehl{Befehl} % \befehl has now the content “Befehl” and the content of the first definition is lost
>
>    
>> 5. Can I call the macros of the same names in different namespaces (diferent modules)?
>>      
> When you call them inside of a environment it’s possible.
>
> \def\startenvone{\bgroup\def\befehl{command}}
> \def\stopenvone {\egroup}
>
> \def\startenvtwo{\bgroup\def\befehl{befehl}}
> \def\stopenvtwo {\egroup}
>
> \starttext
> \startenvone \befehl \stopenvone % \befehl == “command”
> \startenvtwo \befehl \stopenvtwo % \befehl == “befehl”
> \stoptext
>
>    
>> 6. Can I read about somewhere more?
>>      
> - The programming pages on the wiki.
> - A book about plain TeX {e.g. The TeXbook, TeX by Topic, TeX for the Impatient etc.)
>
>    
>> 7. I enclose below a minimal example of the module (I do not know why there are some things) to comment or write yours comments and suggestions, etc.
>>      
> Give me some time to write a detailed description of the \definenamespace command.
>
> Wolfgang
>
>
>    



More information about the ntg-context mailing list