google / flatbuffers

FlatBuffers: Memory Efficient Serialization Library
https://flatbuffers.dev/
Apache License 2.0
22.52k stars 3.19k forks source link

[Feature Request] Add switch to enable alternate runtime implementations [Nim, any compiler, any OS, master] #8335

Open cypherwytch opened 2 weeks ago

cypherwytch commented 2 weeks ago

Hi all :)

I was wondering if it would be possible to add a switch to flatc's Nim code generation to allow developers to choose which package name the generated code should import. Currently, flatc --nim hardcodes an import flatbuffers into generated files, referencing this project's Nim implementation, but this raises a number of issues:

I was working on a forked implementation of this project's Nim package to address the first four points, but found myself facing the issue of conflicting package names. Following a quick discussion with the author of the existing flatBuffers package, we agreed that it would be worth adding an option to make the package name adjustable in the flatc --nim generated code, rather than the hardcoded import flatbuffers that exists currently.

Perhaps something along the lines of flatc --nim --nim-package-name=flatbuffers-runtime, which would instead generate import flatbuffers-runtime in the generated files?