Can't use function with same name as module?
Shriramana Sharma
not.sure.why.a.mail.id.is.needed.even.if.invalid at gmail.com
Tue Oct 17 11:46:28 UTC 2017
On Tuesday, 17 October 2017 at 08:26:12 UTC, Daniel Kozak wrote:
> You can:
> import fun : fun;
Yes I found this but it is unnecessarily verbose.
At the same time I also find that it is possible to declare a
struct or class with the same name as module:
str.d:
struct str { int a; }
strmain.d:
import str;
void main() { str var; var.a = 2; }
cla.d:
class cla { int a; }
clamain.d:
import cla;
void main() { auto var = new cla; var.a = 2; }
$ dmd -ofstr str.d strmain.d
$ dmd -ofcla cla.d clamain.d
Problem only with function. If there can be a class or struct
then what's the problem with function? Doesn't look like any of
the problems which "will come and bite you later" in this case…
More information about the Digitalmars-d-learn
mailing list