On 16/05/14 09:58, Dylan Knutson wrote:

Ya know, it might be able to be made into a struct; I'll fiddle with it
tomorrow. The main reason it was made a class was so .join had to take a
Table type as its first parameter, and internally Table implements a
Joinable interface (which is needed for chaining .joins and propagating
the table name during printing).

Can you do compile time introspection, like ranges do? Basically check if it has a "join" method.

The Sql class is needed because it's a node in the AST (all nodes
inherit from a basic Node class) that just prints out its content
verbatim when to_sql is called. All the methods that take a Node would
need to be modified/templated to also accept a specialized SQL struct
type, which unfortunately isn't feasible. If it was done, it'd probably
be implemented using std.variant's Algebraic type, but then CTFE is
forfeited. If you know of another way to go about doing this, I'd be
really interested in hearing it. It is unfortunate that the library has
to make so many small allocations, for sure.

I don't know, use structs and compile time introspection.

Another option is, you could try using CTFE as much as possible to get
the allocations over with at compile time :)



--
/Jacob Carlborg

Reply via email to