All Hydra writers (serializers) use the hydra.serialization module to create expressions of type hydra.ast.Expr, which are then actually mapped to strings, independently of any particular writer. The whitespace of the resulting string is specified in the Expr according to tightly constrained patterns. However, the writers still have a lot of freedom w.r.t. where they wrap lines and indent blocks. Some do a better job of creating compact, readable code than others, keeping lines less than 120 characters in length and breaking in logical places. Others haven't received as much attention and don't do as well. Hydra's writers could use an overhaul which considers:
- Whether the
Expr syntax and/or hydra.serialization syntax helpers can be improved in any way
- Whether we can provide more and better helper functions to relieve individual writers of some of the burden associated with generated readable code (e.g. line wrapping in appropriate places)
- How well the individual writers are using the available tools
The result will hopefully be a more consistent look and feel of Hydra-generated code across targets, and an easier on-ramp for new formats in the future.
All Hydra writers (serializers) use the
hydra.serializationmodule to create expressions of typehydra.ast.Expr, which are then actually mapped to strings, independently of any particular writer. The whitespace of the resulting string is specified in theExpraccording to tightly constrained patterns. However, the writers still have a lot of freedom w.r.t. where they wrap lines and indent blocks. Some do a better job of creating compact, readable code than others, keeping lines less than 120 characters in length and breaking in logical places. Others haven't received as much attention and don't do as well. Hydra's writers could use an overhaul which considers:Exprsyntax and/orhydra.serializationsyntax helpers can be improved in any wayThe result will hopefully be a more consistent look and feel of Hydra-generated code across targets, and an easier on-ramp for new formats in the future.