Closed heri16 closed 3 years ago
explanation https://github.com/halturin/ergo/pull/68#discussion_r680967840 why this approach can't be accepted
First off, thanks so much for the great work on this library.
I hope to be able to bring to light the extensive research done by the Elixir team with regards to interoperability with Erlang: https://elixirschool.com/en/lessons/advanced/erlang/#strings
Please see https://github.com/halturin/ergo/pull/68#discussion_r681109604 on why this approach should be accepted.
I'll let the creator of Erlang explain further:
https://elixirforum.com/t/why-are-charlist-and-string-co-existing-in-erlang/31566
Two different erlang authors interfacing to lua<-> erlang.
Both came to the same conclusion independently, that erlang's binary-strings should be mapped to lua "string", and erlang's list-strings should be mapped to lua lists.
https://github.com/rtraschke/erlang-lua#value-translation-from-erlang-to-lua
https://github.com/rvirding/luerl/wiki/0.7-Data-representation#data-types
https://github.com/rvirding/luerl/wiki/0.7-Data-representation#strings
Because Lua doesn't have a binary type. Anyway, you may want to try my implementation in the 'otp2324' branch. See README file there.
Ruby has byte arrays.
See how types are mapped: http://www.erlang-factory.com/upload/presentations/36/tom_preston_werner_erlectricity.pdf
Who said that's a good mapping? :) especially looking at
... let alone this project is on hold last 13 years ))
Feel free to make a fork with data mapping you like. This PR won't be accepted. I've made etf.String and etf.Charlist to support interaction with Erlang/Elixir and it should be enough so far
not valid any more
Implement encode/decode for the types below without affecting node logic. (All tests pass)
Mapping Types
Pros:
Cons:
[]byte
are now sent as ETF bit_binary with bits set to 8. (Overhead of 1 byte)