Hacker News new | comments | show | ask | jobs | submit login

Interesting, but surprising they didn't look at how Erlang bit syntax works. http://erlang.org/doc/programming_examples/bit_syntax.html

It's considerably more flexible, much more elegant, and (in Erlang) battle-tested.

I wrote an Erlang-inspired version of bitstrings for OCaml: https://people.redhat.com/~rjones/bitstring/html/Bitstring.h...




This is because wssdl is still within the boundaries of the lua grammar: the file you provide is still lua, so you have to abide by its rule.

I experimented with a key/value approach on the syntax itself (something like `{ src_port = u16 }` or `{ src_port = 16 }`), which was nicer, but the problem was that, in lua, table literals are unordered. The current approach uses the method syntax (`a:b()`) as a nice workaround, but this mandates the use of parenthesis after the type and other specifiers. This is fine though since a lot of the provided types are parameterized (e.g. `bytes(n)` which takes a number of octets)


Agreed on the syntax, but Erlang probably isn't as easy to integrate. It's a system that very much likes to be the center of its world.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: