cortoproject / corto

A hierarchical object store for connecting realtime machine data with web applications, historians & more
https://www.corto.io
MIT License
86 stars 14 forks source link

Remove ability to specify prefixes for code generators #663

Closed SanderMertens closed 6 years ago

SanderMertens commented 6 years ago

The current code generation framework allows the user to specify a prefix, that can replace the package identifier. For example, object world in package foo_bar could specify a prefix hello, so that instead of foo_bar_world, the identifier is generated as hello_world.

However, this functionality causes problems, as packages that attempt to use this package now also need to be aware of the prefix with which the package was generated. This introduces complexity in the code generators, and also hurts uniformity across the framework: it makes it hard to predict what the generated identifier for a specific object will be.

Prefixes were introduced because always having to specify the full path of an identifier can be tedious, especially for deeply nested projects. In practice, projects by default used a prefix that is only their own identifier, so for example, package foo_bar would have prefix bar.

The latter behavior should become encoded into the code generators, and it should no longer be possible to specify custom prefixes. Furthermore, objects should always be accessible through their fully qualified names (foo_bar_world). The generated code should ensure that when using the shorter name (bar_world) causes name clashes with another included package, conflicting definitions are disabled (through use of a macro).