Re: Modules and name clashing.
Posted: Sun Jun 23, 2013 12:57 am
freak wrote: Imho, these are the two styles that are useful with Modules
- give descriptive names that stand on their own, use UseModule and only write the full name to avoid (rare) conflicts
- give shorter names for simplicity inside the module and write the full name outside to keep the meaning of the call clear
I agree those are the two sensible options.
I find the second option not particularly appealing because of the need to qualify every constant passed to the module:
Code: Select all
DeclareModule test
#const1 = 10
Declare proc(par)
EndDeclareModule
Module test
Procedure proc(par)
Debug "proc" + par
EndProcedure
EndModule
test::proc(test::#const1)
The discussion here was intended by me as worst case scenarios, when you already did what was sensible to do but wasn't enough to avoid conflicts.
I like to analyze the worst cases even when they can be avoided most of the time, to know what my options are when common good practices are not enough.
I'll have to experiment a little with a real lib to see what's the option I feel more comfortable with, if any.
Thanks for the suggestions