[erlang-questions] Bit Syntax and compiler Erlang/OTP R21.1
Wed Aug 21 09:59:48 CEST 2019
> On 21 Aug 2019, at 02:06, Richard O'Keefe <raoknz@REDACTED> wrote:
> Valentin Micic wrote
> :> If you cannot write 17 loose bits to a file, or,
> :> better yet, if you cannot send 13 loose bits over a socket,
> :> one has to wonder how useful are non-aligned bitstrings
> This is a very odd thing to say. PL/I has had bit strings
> since about 1965. Common Lisp has bit strings. Some Scheme
> implementations have bit strings. APL has bit arrays of any
> size and shape. SQL 92 had BIT(n) and BIT(n) VARYING just
> like PL/I -- surprise surprise -- but SQL 2003 dropped them,
> while Postgres still supports them. Ada has bit strings,
> in the guise of packed arrays of Boolean, replacing Pascal's
> sets (which are fixed size bit strings). Do I need to point
> to bit string support in Java and C#?
> You may not be able to send 13 loose bits over a socket, but
> you *can* have a 13-bit field in a packet, and why should it
> be hard to construct that 13-bit field or to pack it?
Well, as I’ve said, I never had anything against 13-bit field in packet… I was struggling to find a situation where one would benefit from being able to write <<Field:13>> instead of <<Field:13, _:3>>, that is — until Daniel Szoboszlay mentioned compression. Another example from my direct experience (oh irony), which came back to my mind only after Daniels observation, is 7-bit character encoding used by SMS… this would have been way, way easier to implement using bitstrings.
I’ve seen the light, thank you.
Life moves on.
> And of
> course if you are running Erlang on a Raspberry Pi, you can
> send or receive a message of *any* number of bits through the
> Pi's GPIO pins (with the aid of a NIF).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions