www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - modules have to be imported by themselves

reply =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

in order to access module members with fully qualified identifiers the
modules are current required to import themselves.

doesn't compile:
# module a.b;
#
# int i;
#
# void test(){
#     int j = a.b.i;
# }

test case:
http://dstress.kuehne.cn/run/module_01.d

Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCDToO3w+/yD4P9tIRAihzAJoCxK3nsqiinPi9D8FCP8Wt9iWTEACgu2lf
MOTkp6LtRmXiMwvX5geaD8I=
=+QSo
-----END PGP SIGNATURE-----
Feb 11 2005
parent reply "Regan Heath" <regan netwin.co.nz> writes:
On Sat, 12 Feb 2005 00:04:46 +0100, Thomas Kühne  
<thomas-dloop kuehne.THISISSPAM.cn> wrote:
 in order to access module members with fully qualified identifiers the
 modules are current required to import themselves.

 doesn't compile:
 # module a.b;
 #
 # int i;
 #
 # void test(){
 #     int j = a.b.i;
 # }

 test case:
 http://dstress.kuehne.cn/run/module_01.d

I assume you know you can just use ".i"? My question is, why do you want 2 ways to achieve the same thing? Is one different in some way, i.e. you can't use ".i" for some reason? Regan
Feb 13 2005
parent reply =?ISO-8859-15?Q?Thomas_K=FChne?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Regan Heath wrote:
| On Sat, 12 Feb 2005 00:04:46 +0100, Thomas Kühne
| <thomas-dloop kuehne.THISISSPAM.cn> wrote:
|
|> in order to access module members with fully qualified identifiers
|> the modules are currently required to import themselves.
|>
|> doesn't compile:
|> # module a.b;
|> #
|> # int i;
|> #
|> # void test(){
|> #     int j = a.b.i;
|> # }
|>
|> test case:
|> http://dstress.kuehne.cn/run/module_01.d
|
|
| I assume you know you can just use ".i"?
| My question is, why do you want 2 ways to achieve the same thing? Is
| one  different in some way, i.e. you can't use ".i" for some reason?

This is only a symptom of a mall-functioning name resolution.

Modules do known their namespace(package+module name), don't they?

file: tmp/a.d
#
# module tmp.b;
#
# int i;
#
# void test(){
#	int m = b.i; // XPASS
#	int n = tmp.b.i; // FAIL
#	int o = a.i; // XFAIL
#	int p = tmp.a.i; // XFAIL
# }
#

It seems that only the module name is honored, not the package name.

Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCD9De3w+/yD4P9tIRAiIcAJ961mg9F1RWmkSEm5P8JGUzRvh5WgCfWSmD
BE9DE661N2gegsfs9aW7lls=
=Pzo/
-----END PGP SIGNATURE-----
Feb 13 2005
parent reply "Regan Heath" <regan netwin.co.nz> writes:
On Sun, 13 Feb 2005 23:12:46 +0100, Thomas Kühne  
<thomas-dloop kuehne.THISISSPAM.cn> wrote:
 Regan Heath wrote:
 | On Sat, 12 Feb 2005 00:04:46 +0100, Thomas Kühne
 | <thomas-dloop kuehne.THISISSPAM.cn> wrote:
 |
 |> in order to access module members with fully qualified identifiers
 |> the modules are currently required to import themselves.
 |>
 |> doesn't compile:
 |> # module a.b;
 |> #
 |> # int i;
 |> #
 |> # void test(){
 |> #     int j = a.b.i;
 |> # }
 |>
 |> test case:
 |> http://dstress.kuehne.cn/run/module_01.d
 |
 |
 | I assume you know you can just use ".i"?
 | My question is, why do you want 2 ways to achieve the same thing? Is
 | one  different in some way, i.e. you can't use ".i" for some reason?

 This is only a symptom of a mall-functioning name resolution.

Sure, I agree. But, my question is what is the point of having two methods to do the same thing?
 Modules do known their namespace(package+module name), don't they?

Apparently not.
 file: tmp/a.d
 #
 # module tmp.b;
 #
 # int i;
 #
 # void test(){
 #	int m = b.i; // XPASS
 #	int n = tmp.b.i; // FAIL
 #	int o = a.i; // XFAIL
 #	int p = tmp.a.i; // XFAIL
 # }
 #

 It seems that only the module name is honored, not the package name.

I still don't understand xpass, fail, xfail etc. What does the 'x' mean? Regan
Feb 13 2005
parent =?ISO-8859-15?Q?Thomas_K=FChne?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Regan Heath wrote:

| On Sun, 13 Feb 2005 23:12:46 +0100, Thomas Kühne
| <thomas-dloop kuehne.THISISSPAM.cn> wrote:
|
|> Regan Heath wrote:
|> | On Sat, 12 Feb 2005 00:04:46 +0100, Thomas Kühne
|> | <thomas-dloop kuehne.THISISSPAM.cn> wrote:
|> |
|> |> in order to access module members with fully qualified identifiers
|> |> the modules are currently required to import themselves.
|> |>
|> |> doesn't compile:
|> |> # module a.b;
|> |> #
|> |> # int i;
|> |> #
|> |> # void test(){
|> |> #     int j = a.b.i;
|> |> # }
|> |>
|> |> test case:
|> |> http://dstress.kuehne.cn/run/module_01.d
|> |
|> |
|> | I assume you know you can just use ".i"?
|> | My question is, why do you want 2 ways to achieve the same thing? Is
|> | one  different in some way, i.e. you can't use ".i" for some reason?
|>
|> This is only a symptom of a mall-functioning name resolution.
|
| Sure, I agree. But, my question is what is the point of having two
| methods  to do the same thing?

Using the full quallifier is very usefull if portions of the code are
likely to be copied/moved into other modules in the near future.

|> Modules do known their namespace(package+module name), don't they?
|
| Apparently not.
|
|> file: tmp/a.d
|> #
|> # module tmp.b;
|> #
|> # int i;
|> #
|> # void test(){
|> #    int m = b.i; // XPASS
|> #    int n = tmp.b.i; // FAIL
|> #    int o = a.i; // XFAIL
|> #    int p = tmp.a.i; // XFAIL
|> # }
|> #
|>
|> It seems that only the module name is honored, not the package name.
|
| I still don't understand xpass, fail, xfail etc. What does the 'x' mean?

pass	test case was expected to pass, and it did
xpass	test case was expected to fail, but passed
fail	test case was expected to pass, but failed
xfail	test case was expected to fail, and it did

Thomas

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCD+Eq3w+/yD4P9tIRAunWAKC3JkMbgDxWfoJcbVgat99rPzfdPQCgtU5R
Q90vsmsQpK/4oLgSRDQAzEI=
=wndd
-----END PGP SIGNATURE-----
Feb 13 2005