digitalmars.D.bugs - Nested types can't be forward referenced
- Stewart Gordon (35/35) May 31 2005 Using DMD 0.125, Windows 98SE.
- Lars Ivar Igesund (9/47) May 31 2005 From the Nested functions documentation:
-
Stewart Gordon
(12/17)
May 31 2005
- Lars Ivar Igesund (3/22) May 31 2005 Probably a good point. Woke up to early this morning...
- Hasan Aljudy (4/42) May 31 2005 To my humble understanding, nested types only exist inside their "outer"...
-
Stewart Gordon
(7/25)
Jun 01 2005
- Hasan Aljudy (3/31) Jun 01 2005 If you imply that Yuiop.Asdfg becomes known to everything that comes
- Stewart Gordon (8/10) Jun 01 2005 That's basically what I said. I.e. the order of declarations at module
- Hasan Aljudy (5/17) Jun 01 2005 I meant to say that maybe the bug is actually in Yuiop.Asdfg being
- Stewart Gordon (10/14) Jun 02 2005 Wrong. Members of a class/struct/union have to be known to things
- Thomas Kuehne (16/48) Jun 01 2005 -----BEGIN PGP SIGNED MESSAGE-----
Using DMD 0.125, Windows 98SE. ---------- struct Qwert { Yuiop.Asdfg hjkl; } struct Yuiop { struct Asdfg { int zxcvb; } } ---------- D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): no property 'Asdfg' for type 'Yuiop' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): Yuiop.Asdfg is used as a type D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): variable nesttype_forward.Qwert.hjkl voids have no value ---------- OTOH if Yuiop is instead a class, then the error is ---------- D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(5): class nesttype_forward.Yuiop is forward referenced when looking for 'Asdfg' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(5): class nesttype_forward.Yuiop is forward referenced when looking for 'Asdfg' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): no property 'Asdfg' for type 'nesttype_forward.Yuiop' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): Yuiop.Asdfg is used as a type D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): variable nesttype_forward.Qwert.hjkl voids have no value ---------- Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
May 31 2005
Stewart Gordon wrote:Using DMD 0.125, Windows 98SE. ---------- struct Qwert { Yuiop.Asdfg hjkl; } struct Yuiop { struct Asdfg { int zxcvb; } } ---------- D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): no property 'Asdfg' for type 'Yuiop' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): Yuiop.Asdfg is used as a type D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): variable nesttype_forward.Qwert.hjkl voids have no value ---------- OTOH if Yuiop is instead a class, then the error is ---------- D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(5): class nesttype_forward.Yuiop is forward referenced when looking for 'Asdfg' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(5): class nesttype_forward.Yuiop is forward referenced when looking for 'Asdfg' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): no property 'Asdfg' for type 'nesttype_forward.Yuiop' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): Yuiop.Asdfg is used as a type D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): variable nesttype_forward.Qwert.hjkl voids have no value ---------- Stewart.From the Nested functions documentation: "Unlike module level declarations, declarations within function scope are processed in order. This means that two nested functions cannot mutually call each other:" So I suppose that this isn't really a bug, but more like a very bad error message. The docs also say that the restriction might be removed in the future. Lars Ivar Igesund
May 31 2005
Lars Ivar Igesund wrote: <snip>From the Nested functions documentation: "Unlike module level declarations, declarations within function scope are processed in order. This means that two nested functions cannot mutually call each other:"<snip> Non sequitur. That's nested _functions_. This is nested _types_. Moreover, they're somewhat different concepts. Functions define a sequence of actions. Types don't. Moreover, aren't nested functions only accessible from the scope in which they're defined? Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
May 31 2005
Stewart Gordon wrote:Lars Ivar Igesund wrote: <snip>Probably a good point. Woke up to early this morning... Lars Ivar IgesundFrom the Nested functions documentation: "Unlike module level declarations, declarations within function scope are processed in order. This means that two nested functions cannot mutually call each other:"<snip> Non sequitur. That's nested _functions_. This is nested _types_. Moreover, they're somewhat different concepts. Functions define a sequence of actions. Types don't. Moreover, aren't nested functions only accessible from the scope in which they're defined? Stewart.
May 31 2005
Stewart Gordon wrote:Using DMD 0.125, Windows 98SE. ---------- struct Qwert { Yuiop.Asdfg hjkl; } struct Yuiop { struct Asdfg { int zxcvb; } }To my humble understanding, nested types only exist inside their "outer" type. Asdfg only exists inside the scope of Yuiop.---------- D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): no property 'Asdfg' for type 'Yuiop' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): Yuiop.Asdfg is used as a type D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): variable nesttype_forward.Qwert.hjkl voids have no value ---------- OTOH if Yuiop is instead a class, then the error is ---------- D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(5): class nesttype_forward.Yuiop is forward referenced when looking for 'Asdfg' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(5): class nesttype_forward.Yuiop is forward referenced when looking for 'Asdfg' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): no property 'Asdfg' for type 'nesttype_forward.Yuiop' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): Yuiop.Asdfg is used as a type D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): variable nesttype_forward.Qwert.hjkl voids have no value ---------- Stewart.
May 31 2005
Hasan Aljudy wrote:Stewart Gordon wrote:<snip> To your humble understanding indeed. Just try moving Qwert to below Yuiop. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.Using DMD 0.125, Windows 98SE. ---------- struct Qwert { Yuiop.Asdfg hjkl; } struct Yuiop { struct Asdfg { int zxcvb; } }To my humble understanding, nested types only exist inside their "outer" type.
Jun 01 2005
Stewart Gordon wrote:Hasan Aljudy wrote:If you imply that Yuiop.Asdfg becomes known to everything that comes /after/ it, then maybe /that/ is the bug.Stewart Gordon wrote:<snip> To your humble understanding indeed. Just try moving Qwert to below Yuiop. Stewart.Using DMD 0.125, Windows 98SE. ---------- struct Qwert { Yuiop.Asdfg hjkl; } struct Yuiop { struct Asdfg { int zxcvb; } }To my humble understanding, nested types only exist inside their "outer" type.
Jun 01 2005
Hasan Aljudy wrote: <snip>If you imply that Yuiop.Asdfg becomes known to everything that comes /after/ it, then maybe /that/ is the bug.That's basically what I said. I.e. the order of declarations at module or class/struct/union level is supposed not to matter. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jun 01 2005
Stewart Gordon wrote:Hasan Aljudy wrote: <snip>I meant to say that maybe the bug is actually in Yuiop.Asdfg being /known/ outside Yuiop when they come after it; it shouldn't be known there. so the bug is not in being unknown to things above it, it's in being known to things below it.If you imply that Yuiop.Asdfg becomes known to everything that comes /after/ it, then maybe /that/ is the bug.That's basically what I said. I.e. the order of declarations at module or class/struct/union level is supposed not to matter. Stewart.
Jun 01 2005
Hasan Aljudy wrote: <snip>I meant to say that maybe the bug is actually in Yuiop.Asdfg being /known/ outside Yuiop when they come after it; it shouldn't be known there. so the bug is not in being unknown to things above it, it's in being known to things below it.Wrong. Members of a class/struct/union have to be known to things outside it. Otherwise how would you use the class/struct/union? And unless you can find a nook or cranny of the spec that states otherwise, then nested types aren't an exception. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jun 02 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Stewart Gordon schrieb am Tue, 31 May 2005 11:47:08 +0100:Using DMD 0.125, Windows 98SE. ---------- struct Qwert { Yuiop.Asdfg hjkl; } struct Yuiop { struct Asdfg { int zxcvb; } } ---------- D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): no property 'Asdfg' for type 'Yuiop' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): Yuiop.Asdfg is used as a type D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): variable nesttype_forward.Qwert.hjkl voids have no value ---------- OTOH if Yuiop is instead a class, then the error is ---------- D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(5): class nesttype_forward.Yuiop is forward referenced when looking for 'Asdfg' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(5): class nesttype_forward.Yuiop is forward referenced when looking for 'Asdfg' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): no property 'Asdfg' for type 'nesttype_forward.Yuiop' D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): Yuiop.Asdfg is used as a type D:\My Documents\Programming\D\Tests\bugs\nesttype_forward.d(2): variable nesttype_forward.Qwert.hjkl voids have no value ---------- Stewart.Added to DStress as http://dstress.kuehne.cn/run/f/forward_reference_12_A.d http://dstress.kuehne.cn/run/f/forward_reference_12_B.d http://dstress.kuehne.cn/run/f/forward_reference_12_C.d http://dstress.kuehne.cn/run/f/forward_reference_12_D.d http://dstress.kuehne.cn/run/f/forward_reference_12_E.d http://dstress.kuehne.cn/run/f/forward_reference_12_F.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCni+23w+/yD4P9tIRAo9TAKC4+n0Mt4RfxBXfij1hMxTUoARq5QCfdQbI p320uR1KntTb5FnqF47ktT0= =TmEh -----END PGP SIGNATURE-----
Jun 01 2005