demilletech / protobuf-elixir

A pure Elixir implementation of Google Protobuf
MIT License
0 stars 0 forks source link

Optimize type URL implementation #3

Open jdemilledt opened 5 years ago

jdemilledt commented 5 years ago

Continuing discussion from tony612#54.

@aquarhead commented:

Providing type_fqdn as defoverridable might not be the best way to customize it... Especially if generating code through the provided protoc plugin (I think?). You'd need to either manually add def type_fqdn to all generated modules or somehow modify the protoc plugin...

How about just putting it as an optional parameter, then user can find a performant way to feed that information in. I think OTP 22's persistent_term might be a good solution here? Or https://github.com/discordapp/fastglobal for older OTP releases.

@matehat commented:

Isn’t it usually provided as an option in the .proto file or to the protoc compiler? The code generator could just automatically insert that function in generated module after having detected the option either way?

jdemilledt commented 5 years ago

1 was merged, but we can build on it since we have not made a new release yet.

jdemilledt commented 5 years ago

I plan to also output the real namespace into the file instead of trying to infer it from the module name since people may have module name prefixes.