proc foo(x:Thing,y:string)
can be called using an alternate (method-like) syntax:
x.foo(y)
But when foo is imported from a module by
from modfoo import nil
so as to force use of modfoo qualification, I could only think to code:
modfoo.foo(x,y)
Is there a syntax to use something like the x.foo(y) notation?
Would it be a good idea to have a different operator to access module's symbols ?
Maybe :: ?
I guess some notation x.ZZZZ(y) where the ZZZZ somehow indicates the use of the proc foo which is imported from modfoo
Probably something like:
x.foo[modfoo](y)
or
x.modfoo[foo](y)
or maybe
x.(modfoo.foo)(y)
but neither of those really fit well into the nim syntax scheme. Oh, well, maybe it is a bad idea.
import modfoo as mfoo
mfoo::x.foo(y)
x.mfoo::foo(y)
So we can have some more complex code.
import foo1,foo2
x.foo1::foo(y).foo2::foo(z)
But anyway,it only happened when import some procs having exactly the same signature.Quite rare situation but namespace indicating with OOP is necessary.
Most of the time x.foo(y) is enough.
x.foo1::foo(y).foo2::foo(z)
should same as
foo2.foo(foo1.foo(x,y),y) #I even not sure is this correct,nesting is hard to read and write.
suppose foo1.foo and foo2.foo has exactly the same signature.
By the way,I hate c++'s :: style,but nesting is worse.