チケット #45206

generate_packets.py: Introduce hierarchy of types

登録: 2022-07-24 22:17 最終更新: 2022-07-26 21:45

報告者:
担当者:
チケットの種類:
状況:
完了
コンポーネント:
マイルストーン:
優先度:
5 - 中
重要度:
5 - 中
解決法:
修正済み
ファイル:
なし

詳細

Part of #43927. As described previously:

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.

チケットの履歴 (6 件中 3 件表示)

2022-07-24 22:17 更新者: alienvalkyrie
  • 新しいチケット "generate_packets.py: Introduce hierarchy of types" が作成されました
2022-07-24 22:52 更新者: alienvalkyrie
  • 詳細が更新されました
2022-07-24 23:16 更新者: alienvalkyrie
  • 詳細が更新されました
2022-07-25 02:48 更新者: alienvalkyrie
  • 詳細が更新されました
2022-07-25 06:48 更新者: alienvalkyrie
  • 詳細が更新されました
コメント

All sub-issues are now in review. Once they are merged, this ticket will be closed.

2022-07-26 21:45 更新者: alienvalkyrie
  • 状況オープン から 完了 に更新されました
  • 解決法なし から 修正済み に更新されました

添付ファイルリスト

添付ファイルはありません

編集

このチケットにコメントを追加するには、ログインが必要です » ログインする