Topic: attribute for meta information


Author: vova.cpp@gmail.com
Date: Fri, 20 Sep 2013 09:06:28 -0700 (PDT)
Raw View
------=_Part_408_20608501.1379693188406
Content-Type: text/plain; charset=ISO-8859-1

add attribute (like [[meta]] or [[info]]) thet create specialization of
class "dynamic trait" for type/func/enum/...

so we can use it like extended type traits

meta<MyEnum>::items[3].name
meta<MyClass>::field[0].name //shift, size, typeid, ....
meta<func>::signature
etc

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_408_20608501.1379693188406
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">add attribute (like [[meta]] or [[info]]) thet create spec=
ialization of class "dynamic trait" for type/func/enum/... <br><br>so we ca=
n use it like extended type traits<br><br>meta&lt;MyEnum&gt;::items[3].name=
<br>meta&lt;MyClass&gt;::field[0].name //shift, size, typeid, ....<br>meta&=
lt;func&gt;::signature<br>etc<br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_408_20608501.1379693188406--

.


Author: Jonathan Wakely <cxx@kayari.org>
Date: Fri, 20 Sep 2013 09:19:35 -0700 (PDT)
Raw View
------=_Part_205_29196856.1379693975399
Content-Type: text/plain; charset=ISO-8859-1

On Friday, September 20, 2013 5:06:28 PM UTC+1, vova...@gmail.com wrote:
>
> add attribute (like [[meta]] or [[info]]) thet create specialization of
> class "dynamic trait" for type/func/enum/...
>
> so we can use it like extended type traits
>
> meta<MyEnum>::items[3].name
> meta<MyClass>::field[0].name //shift, size, typeid, ....
> meta<func>::signature
> etc
>

I think you need to explain this a bit more.

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_205_29196856.1379693975399
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, September 20, 2013 5:06:28 PM UTC+1, vova...@gm=
ail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"=
>add attribute (like [[meta]] or [[info]]) thet create specialization of cl=
ass "dynamic trait" for type/func/enum/... <br><br>so we can use it like ex=
tended type traits<br><br>meta&lt;MyEnum&gt;::items[3].name<br>meta&lt;MyCl=
ass&gt;::field[0].name //shift, size, typeid, ....<br>meta&lt;func&gt;::sig=
nature<br>etc<br></div></blockquote><div><br>I think you need to explain th=
is a bit more. <br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_205_29196856.1379693975399--

.


Author: vova.cpp@gmail.com
Date: Fri, 20 Sep 2013 10:12:45 -0700 (PDT)
Raw View
------=_Part_548_28637082.1379697165960
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



=D0=9F=CA=BC=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D1=8F, 20 =D0=B2=D0=B5=D1=80=D0=
=B5=D1=81=D0=BD=D1=8F 2013 =D1=80. 17:19:35 UTC+1 =D0=BA=D0=BE=D1=80=D0=B8=
=D1=81=D1=82=D1=83=D0=B2=D0=B0=D1=87 Jonathan Wakely=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=B2:
>
> On Friday, September 20, 2013 5:06:28 PM UTC+1, vova...@gmail.com wrote:
>>
>> add attribute (like [[meta]] or [[info]]) thet create specialization of=
=20
>> class "dynamic trait" for type/func/enum/...=20
>>
>> so we can use it like extended type traits
>>
>> meta<MyEnum>::items[3].name
>> meta<MyClass>::field[0].name //shift, size, typeid, ....
>> meta<func>::signature
>> etc
>>
>
> I think you need to explain this a bit more.=20
>
Many tasks require rich meta-information(more than can give typeid). For=20
example for build SQL-queries from struct we need names of fields:
struct person {string name;  int salary} -> SELECT name, salary FROM person
or create table or interact with script or serialization or ...
So we need something like person::meta_info where meta_info is a struct=20
with this information we need. But similar information we need from=20
functions or enums that dont have  operator "::" and C++ do not produce=20
meta information for all types.
My proposal is to introduce attribute [[meta]]:
struct [[meta]] person {string name;  int salary};
this code forces compiler to create "meta" template specialization
template<>
class meta<person> {
    fieldinfo[] fields =3D { {name=3D"name", type=3D"std::string", shift=3D=
0,=20
size=3D28}, ... } // array of field info structures
    methodinfo[] =3D {} // array of method info structures
    size_t obj_size =3D 32;//byte
}

or for function:
int main [[meta]] (char** argc, int argv) {...}
template specialization
template<>
class meta<main> {
    arginfo[] args =3D { {name=3D"name", type=3D"char**"}, ... } // array o=
f arg=20
info structures
    return_type =3D ....
    name =3D "main"
    ....
}

--=20

---=20
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 e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_548_28637082.1379697165960
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>=D0=9F=CA=BC=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D1=8F, =
20 =D0=B2=D0=B5=D1=80=D0=B5=D1=81=D0=BD=D1=8F 2013 =D1=80. 17:19:35 UTC+1 =
=D0=BA=D0=BE=D1=80=D0=B8=D1=81=D1=82=D1=83=D0=B2=D0=B0=D1=87 Jonathan Wakel=
y =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=B2:<blockquote class=3D"gmail_quo=
te" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;paddi=
ng-left: 1ex;"><div dir=3D"ltr">On Friday, September 20, 2013 5:06:28 PM UT=
C+1, <a>vova...@gmail.com</a> wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr">add attribute (like [[meta]] or [[info]]) thet create spe=
cialization of class "dynamic trait" for type/func/enum/... <br><br>so we c=
an use it like extended type traits<br><br>meta&lt;MyEnum&gt;::items[3].nam=
e<br>meta&lt;MyClass&gt;::field[0].name //shift, size, typeid, ....<br>meta=
&lt;func&gt;::signature<br>etc<br></div></blockquote><div><br>I think you n=
eed to explain this a bit more. <br></div></div></blockquote><div>Many task=
s require rich meta-information(more than can give typeid). For example for=
 build SQL-queries from struct we need names of fields:<br>struct person {s=
tring name;&nbsp; int salary} -&gt; SELECT name, salary FROM person<br>or c=
reate table or interact with script or serialization or ...<br>So we need s=
omething like person::meta_info where meta_info is a struct with this infor=
mation we need. But similar information we need from functions or enums tha=
t dont have&nbsp; operator "::" and C++ do not produce meta information for=
 all types.<br>My proposal is to introduce attribute [[meta]]:<br>struct [[=
meta]] person {string name;&nbsp; int salary};<br>this code forces compiler=
 to create "meta" template specialization<br>template&lt;&gt;<br>class meta=
&lt;person&gt; {<br>&nbsp;&nbsp;&nbsp; fieldinfo[] fields =3D { {name=3D"na=
me", type=3D"std::string", shift=3D0, size=3D28}, ... } // array of field i=
nfo structures<br>&nbsp;&nbsp;&nbsp; methodinfo[] =3D {} // array of method=
 info structures<br>&nbsp;&nbsp;&nbsp; size_t obj_size =3D 32;//byte<br>}<b=
r><br>or for function:<br>int main [[meta]] (char** argc, int argv) {...}<b=
r> template specialization<br>template&lt;&gt;<br>class meta&lt;main&gt; {<=
br>&nbsp;&nbsp;&nbsp; arginfo[] args =3D { {name=3D"name", type=3D"char**"}=
, ... } // array of arg info structures<br>&nbsp;&nbsp;&nbsp; return_type =
=3D ....<br>&nbsp;&nbsp;&nbsp; name =3D "main"<br>&nbsp;&nbsp;&nbsp; ....<b=
r>}<br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_548_28637082.1379697165960--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 20 Sep 2013 22:03:02 +0300
Raw View
--001a1134c928d3a17704e6d55151
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 20 September 2013 20:12, <vova.cpp@gmail.com> wrote:

>
>
> =D0=9F=CA=BC=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D1=8F, 20 =D0=B2=D0=B5=D1=80=
=D0=B5=D1=81=D0=BD=D1=8F 2013 =D1=80. 17:19:35 UTC+1 =D0=BA=D0=BE=D1=80=D0=
=B8=D1=81=D1=82=D1=83=D0=B2=D0=B0=D1=87 Jonathan Wakely
> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=B2:
>
>> On Friday, September 20, 2013 5:06:28 PM UTC+1, vova...@gmail.com wrote:
>>>
>>> add attribute (like [[meta]] or [[info]]) thet create specialization of
>>> class "dynamic trait" for type/func/enum/...
>>>
>>> so we can use it like extended type traits
>>>
>>> meta<MyEnum>::items[3].name
>>> meta<MyClass>::field[0].name //shift, size, typeid, ....
>>> meta<func>::signature
>>> etc
>>>
>>
>> I think you need to explain this a bit more.
>>
> Many tasks require rich meta-information(more than can give typeid). For
> example for build SQL-queries from struct we need names of fields:
>
>
This is stuff for SG7, the Reflection Study Group. Once that SG gets its
forum going, we can start discussing
this sort of proposals.

--=20

---=20
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 e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--001a1134c928d3a17704e6d55151
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 20 September 2013 20:12,  <span dir=3D"ltr">&lt;<a href=3D"mailt=
o:vova.cpp@gmail.com" target=3D"_blank">vova.cpp@gmail.com</a>&gt;</span> w=
rote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><br>=D0=9F=CA=BC=D1=8F=
=D1=82=D0=BD=D0=B8=D1=86=D1=8F, 20 =D0=B2=D0=B5=D1=80=D0=B5=D1=81=D0=BD=D1=
=8F 2013 =D1=80. 17:19:35 UTC+1 =D0=BA=D0=BE=D1=80=D0=B8=D1=81=D1=82=D1=83=
=D0=B2=D0=B0=D1=87 Jonathan Wakely =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=B2:<div class=3D"im"><blockquote class=3D"gmail_quote" style=3D"margin:0;m=
argin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir=3D"ltr">On Friday, September 20, 2013 5:06:28 PM UTC+1, <a>vova...=
@gmail.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;ma=
rgin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"lt=
r">add attribute (like [[meta]] or [[info]]) thet create specialization of =
class &quot;dynamic trait&quot; for type/func/enum/... <br>
<br>so we can use it like extended type traits<br><br>meta&lt;MyEnum&gt;::i=
tems[3].name<br>meta&lt;MyClass&gt;::field[0].name //shift, size, typeid, .=
....<br>meta&lt;func&gt;::signature<br>etc<br></div></blockquote><div><br>
I think you need to explain this a bit more. <br></div></div></blockquote><=
/div><div>Many tasks require rich meta-information(more than can give typei=
d). For example for build SQL-queries from struct we need names of fields:<=
br>
<br></div></div></blockquote><div><br></div><div>This is stuff for SG7, the=
 Reflection Study Group. Once that SG gets its forum going, we can start di=
scussing<br>this sort of proposals. <br></div></div><br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a1134c928d3a17704e6d55151--

.