There are two userspace approaches that see some usage to deal with types like `:array`:
- There are some alternative/more powerful (but therefore also less portable/general/widespread) alternative 'protocol' implementations, such as `protocol_ex`. These will help if you have new protocols, but will not help to integrate new types with preexisting 'normal' protocols. - A couple of libraries out there that wrap `:array` with a struct and implement common protocols for these (as well as, in the case of arrays, possibly the Access behaviour). For something like `:array`, this should not be significantly slower even though an extra wrapper is used. This technique integrates well with preexisting protocols, but does require you to use the wrapped types in your own code rather than e.g. `:array` directly. ~Marten/Qqwy On 01-09-2021 20:02, José Valim wrote: > We supported tuples before but it led to a bunch of false positives on > records looking like tuples. I think even the the is_array check does > not guarantee it is actually an array. It is only a shallow check. > > On Wed, Sep 1, 2021 at 19:55 [email protected] > <mailto:[email protected]> <[email protected] > <mailto:[email protected]>> wrote: > > Hello, > > Not sure what the go is with protcols, but given that there is an > is_array function, would it be possible to have an erlang :array > dispatch to its own implementation for protocols? > > Right now if you pass an :array to a protocol it treats it as a > Tuple (which is reasonable as right now that's what it is > implemented as). > > Best > > Adam > > -- > You received this message because you are subscribed to the Google > Groups "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > > https://groups.google.com/d/msgid/elixir-lang-core/9faf9f62-72ad-41bd-9179-ee25d155cf65n%40googlegroups.com > > <https://groups.google.com/d/msgid/elixir-lang-core/9faf9f62-72ad-41bd-9179-ee25d155cf65n%40googlegroups.com?utm_medium=email&utm_source=footer>. > > -- > You received this message because you are subscribed to the Google > Groups "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BvO5r9wUe6M3HE%3DOLW%2Bhtu3cjiexD_bvcuhMdDbnYTtQ%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BvO5r9wUe6M3HE%3DOLW%2Bhtu3cjiexD_bvcuhMdDbnYTtQ%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/96d4fd8e-56fb-8aa7-5d25-d5c4d7565e8f%40resilia.nl.
OpenPGP_signature
Description: OpenPGP digital signature
