POETSII / Orchestrator

The Orchestrator is the configuration and run-time management system for POETS platforms.
1 stars 1 forks source link

Possible pessimisation/overhead in DevI parsing #205

Open m8pple opened 3 years ago

m8pple commented 3 years ago

The 1.0.0-alpha parsing code has the following comment:

// Device instantiation. This is not as simple as everything else, because it
// might already have been defined (by accident) and we need to check for this.
// OR it might already have been referenced, but not yet defined and this is it
// OR it might be the first we've seen of it.
// We can't check for undefined references until we leave the XML::GraphInstance
// handler, because devices and edges can be defined in any order
// We hand out the device itself so that the external instance code can tweak
// the device type. Usually it's ignored.

I might be be mis-interpreting, but this seems to be assuming things which can't happen. The grammar is explicitly defined so that all DevI instances must appear before any EdgeI instances. Each DevI should be completely independent, and any repeated id means there is an error, and it is impossible to reference a device id before it is defined. Once you get to the EdgeInstances section you know that all DevI ids are declared, so any device id that is unknown is an error.

It may be the comment has no bearing on the code efficiency, but it jumped out as wrong.