Files
logos-cpp-sdk/cpp-generator/experimental
Dario Gabriel LipicarandClaude Opus 5 1e516c02ce feat(generator): emit the derived module identity methods
Run logos-lidl's injectIdentityMethods() on every ModuleDecl this generator
emits code from, and give the cdylib dispatch a body for the two methods it
adds.

Injection happens at EMISSION points, never at artifact points:

  * generateInterfaceWrappers -- one load point covering both --dep and
    --interface, so a consumer sees name()/version() on every dependency and
    bound interface;
  * --from-header --backend cdylib and --lidl --backend cdylib, so the provider
    answers them;
  * NOT --header-to-lidl, which writes the published contract.

The distinction is belt-and-braces rather than load-bearing: the injected
methods are `derived` and lidlSerialize omits those, so the .lidl a
--from-header build writes stays byte-identical to what --header-to-lidl writes
for the same header.

The dispatch emits a literal for a derived identity method instead of the usual
lidlImpl().<name>(...) -- the author's impl class has no such member, so
delegating would not compile. The literal is the module's own name and version,
so it cannot drift from the metadata the module was built with. A module that
declares name() itself is not derived and still reaches its impl.

290/290 tests pass, 4 new: that the emitted literal is the module's OWN version
(a test at 1.0.0 could not tell a correct generator from one that fell back),
that identity is listed for introspection as well as dispatched, that an
author's own name() still reaches the impl, and that a versionless declaration
falls back rather than emitting "" -- which would read as a failed call.

Requires logos-lidl#10; flake.lock pins that branch until it merges.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 12:40:30 -03:00
..