Open bernardnormier opened 9 months ago
We should also review how we use TypeContext.
It looks like we use it for at least 2 separate purposes:
1) in cs_type_string, to figure out how to map a type based on the "context" (which seems fine)
2) in encode_type and friends, for the special handling for sequence
The original proposal was implemented in 2685accd63ad2deb8dccc7523a217a1b7ebd78ca.
But I agree, more simplification seems possible here.
More cleanup has been done, the biggest being #3893.
Now, we no longer use TypeContext
for the functions that have replaced cs_type_string
.
Now it's really only used in the proxy and dispatch generation code, and the functions that it calls into.
But, there's room for extra improvement, since the proxy side only uses OutgoingParam
and Field
.
And the dispatch side only uses IncomingParam
and Field
.
So in reality, it behaves more like a bool, and we only need 2 of it's values at any given time.
The TypeContext enum is too complicated:
First, we should always treat Field and Nested the same, so there is no need for 2 enumerators. It should always be Field. Then, Encode/Decode are confusing. I propose to rename them IncomingParam / OutgoingParam.