digitalmars.D.learn - Overloading external functions for use in a separate module and...
- Atash (39/39) Aug 20 2013 Some of you StackOverflow-folks may have already seen this
Some of you StackOverflow-folks may have already seen this question. That said... http://stackoverflow.com/questions/18320610/overloading-external-function-for-use-in-a-separate-module That describes the question. Now... Andrei Alexandrescu was awesome enough to throw me a bone, but... no dice. Under the assumption that the double-spacing between the `runrun` decldef and the `import mod_a` represents a separation of files, GDC 4.8.1 spits out "template mod.run does not match any function template declaration. Candidates are:" <the `run` decldef that doesn't accept doubles/>. Given the feel of the situation, I wanted to check with dlang.org-folk to make sure that this isn't a hole I've inadvertently fallen into as far as D features go with respect to uniform function call syntax and the semantics surrounding it. For the sake of discussion, I'm modifying my question a little bit... Let's say I have some function in some module: = BEGIN CODE = == file mod.d module mod; void doStuff(T)(T v) { v.doOtherStuff(); } == file adooblydoo.d module adooblydoo; import mod; struct A; doOtherStuff(A a) { ... } void main() { A a; doStuff(a); } = END CODE = This fails to compile with both DMD 2.063 and GDC 4.8.1 informing me that doOtherStuff is an undefined identifier while instantiating doStuff. Given that Andrei Alexandrescu gave me an answer implying that at least the C++-STL-style of calling was possible, I'm inclined to guess that this is either a bugfeature or at the very least an obscure feature with respect to what I'd assume to be the intended semantics of uniform function call syntax. Soooooo... What is this behavior? (( THANKS FOR READING THAT WHOLE THING [if you didn't and you're reading this little message, I take the thanks back and instead chuck silly putty at your face] ))
Aug 20 2013