The simplest way of doing this is to make your "namespace" an empty type and
use it as an argument:
type myNamespace = object
proc test(_: typedesc[myNamespace], argument: string) =
echo argument
myNamespace.test("Hello world")
Run
This forces you to use `myNamespace` to call the procedure, and if you don't
export that type you don't have any way of calling your procedure. As a bonus
that will all be resolved on compiletime so it won't add any overhead. That
beings said it's generally not recommended to do this in Nim. When you find
yourself fighting a language it is often a sign that you're coming in with some
preconceived notion of the best way of doing something to which the language
disagrees. I'd say try to use Nim as Nim was intended, then if this is still
something you feel is a problem you can implement a solution for it.
As an exercise for the reader it would also be completely feasible to use a
small pragma macro to add that first type, or write a small macro that applied
this to every procedure in a block. This would help readability.