Skip to content

Redesign template variable assignment #26

@kubanrob

Description

@kubanrob

Currently, modules can easily redefine variables.

This may lead to all kinds of indeterministic bugs in the build, as the last module parsed defines the actual value of the variable. (related: issue #15)
On the other hand, we have no canonical way to gather information from multiple modules. This would be very useful for generating registries on build-time. For example: a static object registry shared by the kernel and the init application in MyThOS.

I suggest that we check for redefinition of variables and:

  1. merge arrays and dictionaries
  2. throw an error and abort for any other redefined variable.

The first rule is a bit complicated: For dictionary, we have the same problems as before with duplicated keys. Therefore we should apply the rules recursively for dictionaries.
Merging/concatenating arrays is even worse, as they are ordered per definition. Maybe we should concatenate them in the same order as the module order discussed in issue #15.
The more I think about it: It should be possible to replace the current includeModules function by the array concatenation mechanism.

As a side effect, the second rule enables us to use variable names as a "guard" to forbid some configurations ... I am not sure if this a good idea, though.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions