4 ms·
Yes. I recently wrote an Elixir driver for MonetDB. I also wrote a CLI tool in Go for MonetDB and had to write a subset of the driver. Pattern matching in gene
by latch 6y ago
Yes. I recently wrote an Elixir driver for MonetDB. I also wrote a CLI tool in Go for MonetDB and had to write a subset of the driver.
Pattern matching in general, and binary pattern matching specifically, made the experience (and the resulting code quality) night and day.
The big issue I have with pattern matching / binaries (aka, strings) in elixir / erlang is that doing it efficiently is, at best, a dark art and, at worst, impossible. This was drastically improved in OTP 22, but it's still opaque.
- kamikaz1k 6y ago> The big issue I have with pattern matching / binaries (aka, strings) in elixir / erlang is that doing it efficiently is, at best, a dark art and, at worst, impossible. Sorry, can you elaborate what you mean by impossible? Or maybe what you mean by efficient. Thanks!
- latch 6y agoI just spent some time looking at some old code, and it does seem like OTP 22 solved any of the issues that I had run into at the time. My mistake, sorry about that. (Though I maintain that it's still opaque)
- ergl 6y agoThere's a section about pattern matching and binaries at https://erlang.org/doc/efficiency_guide/binaryhandling.html https://erlang.org/doc/efficiency_guide/binaryhandling.html Compiling with the bin_opt_info flag (erlc +bin_opt_info Mod.erl) will list the points in your code where binaries are created during pattern match, or any other points where binaries could be shared, but are not.