Open zzorba opened 3 weeks ago
I think the difficulty here is that of API design.
If you have a top-level package called entry
, that exports types from foo-crate
and bar-crate
crates, then getting types Foo
from foo
and Bar
from bar
is relatively easy:
import { Foo, Bar } from "entry";
If Baz
is in both foo-crate
and bar-crate
how should the user get at it?
import { fooCrate, barCrate } from "entry";
const { Baz } = fooCrate;
import { Baz_from_fooCrate as Baz } from "entry";
The internals i.e. how the different Baz
types are referred to one another in the generated code is relatively straight forward, now we have a full idea of the types in all components (see type_map
).
Does UBRN handle namespaced names? Not if they are used in the same file (package?)
Theoretically I could have code that refers to two different rust packages of the same name, from different packages, for example both
matrix_sdk::client::Client
andmatrix_sdk_ffi::client::Client
would have the short name of Client. Or I could have a local class and an imported class referred to in the same package, one with a qualified name.Sample rust code:
Thankfully, this doesn't produce incorrect code today, but it does produce an assertion in UBRN and the generate process fails as a result.