lzaeh commented on PR #2760:
URL: https://github.com/apache/fory/pull/2760#issuecomment-3532982012

   > Could you refer to both java and rust implementation? In fory rust, both 
array and vec are supported, they can all be serialized as a list, and 
deserialize a list into target type. We should do similiar thing in go too.
   > 
   > For fory rust, you can refer to `list.rs` and `array.rs`.
   
   Sorry—I was tied up with some real-life errands and didn’t see this message 
in time.
   
   I’ve implemented a version along the lines you suggested by removing the 
array serializers. Details:
   
   (1) Primitive arrays: unless the user provides a specific destination type 
(only array or slice are considered valid), deserialization checks the type and 
length and deserializes accordingly; otherwise (e.g., when the target is 
interface{}) we always deserialize to a slice. 
        This is reflected in some local tests (still supporting array as a 
receiver, and when the receiver is interface{} we convert and compare the 
produced slice against the expected array), as well as in the cross-language 
test(TestXLangSerializer) where arrays are deserialized as slices.
   
   (2) I think the support in (1) is still necessary. While we don’t recommend 
arrays to users, if a struct field is defined as an array (rather than 
interface{}), deserialization will work fine because of (1).
   
   (3) One confusing point: the complex-struct tests had been failing for a 
while. For various reasons I kept pulling the latest code and reinstalling 
pyfory. I did the same this time, and before I had a chance to dig into the 
complex-struct issue, the tests started passing again.
   
   I only opened GitHub after finishing this part of the code—bad workflow on 
my side T_T . I’ll follow your suggestions going forward. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to