Bond – An extensible framework for working with schematized data (microsoft.github.io)
99 points by dons 85 days ago | cached | share | flag | 41 comments
Very cool, seems I missed it the last time it was on HN. From a quick glance over the docs, it seems by default the only parsing interfaces available are "fully realized", i.e. complete conversion to data structures in the target programming language, or "pull based" parsing a bit like expat.
One of the more interesting aspects of a serialization library is how it copes with efficiently extracting small fields out of otherwise large structures, usually by only decoding the absolute minimum required to access the field. This is a common operation e.g. when running aggregate queries over data-at-rest. For example, Cap'n'proto is well suited to this. Does Bond support anything like it?
I can imagine driving the parser APIs using custom code to achieve a similar effect, but that seems a lot of work when there are alternatives that don't require it.
Bond has 3 ways of working with serialized payloads:
1) Simple deserialization where an object is fully materialized. This is the simplest (you write your business logic against idiomatic types in your target language) but, as you note, might not be best from performance perspective in some scenarios.
2) Lazy deserialization at the level of nested structs via bonded<T> [1]. In many cases this allows to optimize performance if you don't need to materialize the whole object but w/o loosing much in terms of simplicity of the programming model.
3) Transforms [2]. This is a very generic and very powerful abstraction in Bond. All higher level APIs like serialization and deserialization are internally implemented using this mechanism (even Python bindings [3] are fully implemented on top of Bond C++ meta-programming infrastructure driving Boost Python). In C++ it is built using template meta-programming and in C# using LINQ expressions. In Both cases it is a little like having a generic, strongly typed parser for richly typed data.
And before Haskell became this trend thing with own web sites and all, SPJ distributed ghc on his MS web site. Usually you had to wait for the Windows binary quite a bit, FreeBSD came first.
He also hosted a "how I make working under Windows NT barely acceptable" document under (research.)microsoft.com.
Yes, besides what the sibling posts already mentioned.
They also use Ocaml[0] and their very own F#.
Erik Meijer was also an Microsoft employee and responsible for bring LINQ and FP programming into the VB.NET and C# languages. Also provided lots of lectures about FP at Channel 9.
Usually many FOSS advocates tend to be unaware how much money the big bad Microsoft has invested into the ML eco-system and making FP concepts mainstream.
Yes, though the number is a little misleading. I believe the core functionality of Bond is all in Haskell, and everything else is just client libraries for other languages.
Our compiler/codegen [1] is all written in Haskell. That's a very significant part of Bond, but I wouldn't say that "everything else is just client libraries". All currently supported languages (C++, C# and Python) heavily rely on meta-programming [2] so the libraries for them are quite sophisticated.
I skimmed the page and honestly wasn't getting what this did. So I looked up Thrift since it is supposedly similar, skimmed and still didn't understand. Same goes for Avro. Finally I looked into Protocol Buffers and bam, I pretty quickly understood what the hell this thing does for me and why I should care. Please, please, please, if you have an open source project give some examples of usage along with the corresponding code, it'll speed up adoption five fold.
Here is ultimately what helped me understand the problem space: