Topic: Fornux C++ Superset - Forward Declarations of Nested Structures


Author: Phil Bouchard <philippeb8@gmail.com>
Date: Tue, 1 May 2018 19:26:58 -0700 (PDT)
Raw View
------=_Part_26717_1237525117.1525228018951
Content-Type: multipart/alternative;
 boundary="----=_Part_26718_877573863.1525228018951"

------=_Part_26718_877573863.1525228018951
Content-Type: text/plain; charset="UTF-8"

Greetings,

In the development of the "Fornux C++ Superset" source-to-source compiler
and its Open Source memory manager counterpart "root_ptr":
https://github.com/philippeb8/root_ptr

Like previously mentioned I noticed the following problems with the C++
language:
- There is no distinction between a pointer and an iterator.
- There is no distinction between pointers to arrays of derived classes and
pointers to arrays of base classes.

But I just realized the following also:
- The C++ language disallows top-level forward declarations of nested
classes.

The latter becomes a problem if you want to, for example, specialize
metadata template classes. Ex:

struct A
{
    struct B
    {};
};

The transpiler will generate:

struct A::B;

namespace metadata
{
    template <>
        struct construct<A::B>
        {
            template <typename... Args>
                A::B operator () (Args const &... args);
        };
}

But the problem is the following statement is not legal:
struct A::B;

So nested structures aren't commutative with template specializations which
makes it impossible to generate metadata on-the-fly. The problem was always
omnipresent but now it causes important problems in this case but also
prevents further extensions of the language.

It's just a matter of making C++ less strict in this case...


Regards,
-Phil

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/cab4cada-1abe-48b2-9a4b-d6c9f994b805%40isocpp.org.

------=_Part_26718_877573863.1525228018951
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Greetings,<div><br></div><div>In the development of the &q=
uot;Fornux C++ Superset&quot; source-to-source compiler and its Open Source=
 memory manager counterpart &quot;root_ptr&quot;:</div><div>https://github.=
com/philippeb8/root_ptr<br></div><div><br></div><div>Like previously mentio=
ned I noticed the following problems with the C++ language:</div><div>- The=
re is no distinction between a pointer and an iterator.</div><div>- There i=
s no distinction between pointers to arrays of derived classes and pointers=
 to arrays of base classes.</div><div><br></div><div>But I just realized th=
e following also:</div><div>- The C++ language disallows top-level forward =
declarations of nested classes.</div><div><br></div><div>The latter becomes=
 a problem if you want to, for example, specialize metadata template classe=
s. Ex:</div><div><br></div><div>struct A</div><div>{</div><div>=C2=A0 =C2=
=A0 struct B</div><div>=C2=A0 =C2=A0 {};</div><div>};</div><div><br></div><=
div>The transpiler will generate:</div><div><br></div><div><div>struct A::B=
;</div><div><br></div><div>namespace metadata</div><div>{</div><div>=C2=A0 =
=C2=A0 template &lt;&gt;<br></div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct c=
onstruct&lt;A::B&gt;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 {</div><div>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 template &lt;typename... Args&gt;</d=
iv><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 A::B operat=
or () (Args const &amp;... args);</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 };<=
br></div><div>}</div></div><div><br></div><div>But the problem is the follo=
wing statement is not legal:</div><div>struct A::B;<br></div><div><br></div=
><div>So nested structures aren&#39;t commutative with template specializat=
ions which makes it impossible to generate metadata on-the-fly. The problem=
 was always omnipresent but now it causes important problems in this case b=
ut also prevents further extensions of the language.=C2=A0</div><div><br></=
div><div>It&#39;s just a matter of making C++ less strict in this case...</=
div><div><br></div><div><br></div><div>Regards,</div><div>-Phil</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/cab4cada-1abe-48b2-9a4b-d6c9f994b805%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/cab4cada-1abe-48b2-9a4b-d6c9f994b805=
%40isocpp.org</a>.<br />

------=_Part_26718_877573863.1525228018951--

------=_Part_26717_1237525117.1525228018951--

.