Earlier quoted context omitted.
I'm not sure exactly what you mean about parameterization, but I suspect in general my notion of what an ORM is differs from yours (in particular, I don't assume lazy loading). Maybe what I'm thinking isn't appropriately called "ORM" (maybe "type relational mapping" is more appropriate?). At any rate, I don't think type safety should be a challenge (somehow a mapping must be generated for each type, just like SQLAlch…
compile-time code generation can only get you so far, unless you're ready to generate every single kind of query beforehand ( which grows exponentially with the number of -to-many relationship). You'll have to rely on introspection but i suspect things won't go smoothly. anyway, it should make for a good exercise i'm sure. as for the definition of Object-Relationnal-Mapper the idea is to completely abstract the fact…
If you know ahead of time what your types are, then you can do everything in code gen easily.
The tough bit is query optimization.