Thursday 3 January 2013

muddle - "no invocation"

Muddle is updated, but you shouldn't be able to tell the difference...

This update is tagged "no-invocation", and is mostly an internal technical change.

Short description: wherever you have written "builder.invocation." you can now write "builder.", leading to shorter lines in your build description, which is a Good Thing. However, "builder.invocation." will continue to work.

Long description: after the cut.


I've merged the Invocation class into the Builder class (both are/were in muddled/mechanics.py).

When muddle was first being designed, it was expected that the Builder class would know how to build things, and the Invocation class would hold information about the particular build description in force - there may have been an intent to allow more than one Invocation per Builder in the back of people's minds.

However, in practice this distinction has never been very well maintained, and has just led to lines of build description code which are unnecessarily long, because they have "builder.invocation." instead of "builder.". Methods have also been added to either class with no particular rhyme or reason,  as well, which doesn't help.

So, I've merged the Invocation class into the Builder class. This does lead to a class that will make pylint seriously unhappy (way too many methods in Builder, to its mind). So that we don't break existing build descriptions, we also set:

    self.invocation = self

inside the Builder __init__ method - i.e., you can still reference "builder.invocation." and have it continue to work.



No comments:

Post a Comment