jdeans289 / icg2

Interface Code Generator 2: Electric Boogaloo
Other
0 stars 2 forks source link

FIXME: Circular Dependencies #33

Closed Mrockwell2 closed 10 months ago

Mrockwell2 commented 11 months ago

https://github.com/jdeans289/icg2/blob/aad7ec8e8f7f9bf1c8214a8f56a8bf46add223de/DataTypes/src/Type/CompositeDataType.cpp#L82-L90

Not sure if this is already resolved, but it seems like this conversation should be in here.

jdeans289 commented 11 months ago

So I don't think we should address this at all in DataTypes.

For one, I don't think it's the DataType classes' responsibility do the compiler's job. Checking for circular dependencies would mean running a cycle finding algorithm over the tree, which certainly could be done, but I don't think we need to.

The way that DataTypes meant to be used is in conjunction with a generator. The generator will not make human mistakes, like leaving off a * when typing the type name and accidentally creating a circular dependency. In addition, when DataTypes are used, the actual data structure is being included in the final executable as well. A struct with circular dependencies will not compile.

Mrockwell2 commented 10 months ago

I think that makes a lot of sense. I think it might be a good idea to add a warning or something to the actual ICG if it doesn't already exist. Barring that, I guess we can just get rid of that comment and close this issue.