高性能对象序列化库,支持求和类型 [英] High performance object serialization library supporting sum types

查看:101
本文介绍了高性能对象序列化库,支持求和类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何高性能的序列化库(例如Google协议缓冲区)是否支持总和类型.

I wonder if any of the high performance serialization libraries (like Google protocol buffers) support sum types.

总和类型被标记为联合,基本上可以说某物是A,B或C.总和类型用于支持

Sum types are tagged unions, basically the ability to say that something is either A, B, or C. Sum types are used in languages such as Haskell and ML which support Algebraic Data Types

推荐答案

如果像Google协议缓冲区一样"是指能够为多种语言生成代码,那么可能不存在.用不支持它们的语言模拟求和类型充其量是尴尬的(例如,尝试在boost:variant上进行模式匹配).因此,如果主要目标是主流语言,则将它们排除在外是很有意义的.

If by "like Google protocol buffers" you mean ability to generate code for multiple languages then probably such thing doesn't exist. Emulating sum types in languages which don't support them is awkward at best (try to pattern match on boost:variant for example). So it makes sense to leave them out if main target is mainstream languages.

如果您只使用haskell/ocaml/,则有很多选择.对于haskell,有谷物 safecopy 以及其他可能的文件.有一个用于ocaml的 piqi项目.

If you are content with using only haskell/ocaml/whatever there is plenty of choices. For haskell there are cereal, binary, safecopy and probably others. There is piqi project for ocaml.

这篇关于高性能对象序列化库,支持求和类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆