C++ Logo

sg7

Advanced search

Re: [SG7] Reflection Usecases

From: Matus Chochlik <chochlik_at_[hidden]>
Date: Wed, 12 Jan 2022 21:23:21 +0100
On Wed, Jan 12, 2022 at 7:47 PM Jonathan O'Connor via SG7 <
sg7_at_[hidden]> wrote:

> Matus,
> As all the interesting work is in creating the select statement, it might
> be easier and quicker to just generate the string! Way easier to write
> tests too!
>
> From what I can see from the ruby world, people use the name of the class,
> function or parameter to generate strings and code. I would guess the
> tricky one is getting the name of the parameter, rather than an argument (I
> had to look up the difference. Parameter name is given in the declaration
> and argument name is given in the definition.)
>
> The examples you've shown so far seem to be writing a reflecting function
> thatreads, writes or calls members of a struct. My table proxy example
> would require you to generate a class and define member functions.Will that
> be possible with your code? I have to read more of the existing SG7 papers.
>

My first try would be to use something similar as the stub class here:

https://github.com/matus-chochlik/mirror/blob/2ee8247437b6cf5fe9f0e812196dbd9921be9262/example/mirror/fake_rpc.cpp#L135

but instead of the serialized RPC request to generate the SQL. For the
moment some of the repetitive stuff (=reflecting the function call
expression and passing on the argument) in the function implementation is
required.
I'll play with this tomorrow.

--Matus

Received on 2022-01-12 20:23:33