The largest change I'm planning on is to introduce a hierarchy of field types. Currently, the ugliest part of the script, by far, is the mass of if-elses in various Field methods, determining how certain things should be done based on field type and array dimensions. My plan is to replace these if-elses with polymorphism – a number of separate classes for every kind of type that needs different treatment, with a common abstract base class (ABC) they all inherit from / implement. This will include a class for array types (that can have an arbitrary other field type as element type), and one (or more) for pseudo-types like string and memory which gobble up the first array dimension as their size to become a proper, useable type.
As prototyped here a while ago. (Note that at some point in the future, the linked branch might not exist anymore if I've cleaned out the repo since then.)
Rough outline:
Create field type classes to represent all data that should move into types: dataio_type and public_type, as well as float_factor and sizes where needed
Move stuff into the field type classes, creating new classes for distinctions as necessary, and deleting old / temporary bridging code as it becomes superfluous
Concrete steps:
#45208 Move type info (dataio type, public type and float factor) and parsing into a new FieldType class
#45209 Split float factor handling into a separate FloatType class
#45210 Make array sizes part of the field type with an ArrayType class
#45211 Move field declaration (Field.get_declar()) into the field type hierarchy
#45212 Move field foldability (Field.folded_into_head) into the field type hierarchy
#45213 Move field fill code (Field.get_fill()) into the field type hierarchy
#45214 Move handle/dsend parameters (currently using Field.get_handle_type()) into the field type hierarchy
#45215 Move handle arguments (currently done directly in write_server/client_impl()) into the field type hierarchy
#45219 Move field get code (Field.get_get_real()) into the field type hierarchy
Note that this is likely to change generated code (particularly for arrays) in some ways.
#45220 Move field cmp code (Field.get_cmp()) into the field type hierarchy
Note that this will change generated code (at minimum for arrays).
#45221 Move field put code (Field.get_put_real()) into the field type hierarchy
Note that this will change generated code (at minimum for diff-arrays).
#45222 Move "un-fill" code from Variant.get_delta_receive_body() into the field type hierarchy
At this point, there should be no more direct outside references to type data. As such, this will be considered complete, and other things that could move into the field type hierarchy (mostly affecting key fields, which are currently always assumed to be ints) will have to be done separately in future tickets.
Part of #43927. As described previously:
As prototyped here a while ago. (Note that at some point in the future, the linked branch might not exist anymore if I've cleaned out the repo since then.)
Rough outline:
Concrete steps:
Note that this is likely to change generated code (particularly for arrays) in some ways.
Note that this will change generated code (at minimum for arrays).
Note that this will change generated code (at minimum for diff-arrays).
At this point, there should be no more direct outside references to type data. As such, this will be considered complete, and other things that could move into the field type hierarchy (mostly affecting key fields, which are currently always assumed to be ints) will have to be done separately in future tickets.